History

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

The conflicts were two cases of overlapping changes in batman-adv and the qed driver.

David S. Miller committed 9 years ago

Commit 0ddead92 parents f7aec12 a090bd4451 files · +3846 −2246Browse files

Unified · Split

451 files
  1. Documentation/admin-guide/kernel-parameters.txt +9 −0
  2. Documentation/devicetree/bindings/usb/dwc2.txt +1 −0
  3. Documentation/networking/scaling.txt +1 −1
  4. MAINTAINERS +11 −12
  5. Makefile +1 −1
  6. arch/arm/boot/dts/bcm283x.dtsi +5 −0
  7. arch/arm/boot/dts/keystone-k2l-netcp.dtsi +2 −2
  8. arch/arm/boot/dts/keystone-k2l.dtsi +8 −0
  9. arch/arm/boot/dts/versatile-pb.dts +1 −1
  10. arch/arm/include/asm/device.h +2 −1
  11. arch/arm/kvm/init.S +2 −3
  12. arch/arm/mach-at91/Kconfig +1 −0
  13. arch/arm/mach-davinci/pm.c +6 −1
  14. arch/arm/mm/dma-mapping.c +14 −15
  15. arch/arm64/Kconfig +0 −4
  16. arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi +1 −2
  17. arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi +1 −2
  18. arch/arm64/configs/defconfig +10 −0
  19. arch/arm64/include/asm/sysreg.h +4 −0
  20. arch/arm64/kvm/hyp-init.S +7 −4
  21. arch/arm64/kvm/vgic-sys-reg-v3.c +5 −5
  22. arch/arm64/net/bpf_jit_comp.c +5 −2
  23. arch/hexagon/mm/uaccess.c +2 −3
  24. arch/powerpc/Kconfig +0 −21
  25. arch/powerpc/include/asm/book3s/64/hash-4k.h +1 −1
  26. arch/powerpc/include/asm/cputable.h +1 −2
  27. arch/powerpc/include/asm/processor.h +12 −13
  28. arch/powerpc/include/asm/topology.h +14 −0
  29. arch/powerpc/kernel/dt_cpu_ftrs.c +48 −10
  30. arch/powerpc/kernel/process.c +3 −0
  31. arch/powerpc/kernel/setup-common.c +1 −1
  32. arch/powerpc/kernel/setup_64.c +2 −2
  33. arch/powerpc/mm/mmu_context_book3s64.c +1 −1
  34. arch/powerpc/perf/power9-pmu.c +2 −2
  35. arch/powerpc/platforms/Kconfig +11 −0
  36. arch/powerpc/platforms/cell/spufs/coredump.c +2 −0
  37. arch/powerpc/platforms/powernv/subcore.c +7 −1
  38. arch/powerpc/platforms/pseries/hotplug-memory.c +2 −0
  39. arch/powerpc/sysdev/simple_gpio.c +2 −1
  40. arch/s390/Kconfig +0 −3
  41. arch/s390/configs/default_defconfig +33 −6
  42. arch/s390/configs/gcov_defconfig +24 −4
  43. arch/s390/configs/performance_defconfig +23 −4
  44. arch/s390/configs/zfcpdump_defconfig +4 −2
  45. arch/s390/defconfig +3 −5
  46. arch/s390/include/asm/kvm_host.h +0 −1
  47. arch/s390/kernel/entry.S +13 −6
  48. arch/s390/kvm/interrupt.c +2 −2
  49. arch/s390/kvm/kvm-s390.c +0 −2
  50. arch/sparc/Kconfig +0 −3
  51. arch/x86/Kconfig +0 −4
  52. arch/x86/kernel/cpu/cyrix.c +1 −0
  53. arch/x86/kernel/cpu/microcode/intel.c +3 −0
  54. arch/x86/kernel/kvm.c +1 −1
  55. arch/x86/kvm/cpuid.c +11 −9
  56. arch/x86/kvm/mmu.c +5 −2
  57. arch/x86/kvm/mmu.h +1 −0
  58. arch/x86/kvm/vmx.c +1 −1
  59. arch/x86/kvm/x86.c +1 −2
  60. arch/xtensa/include/asm/irq.h +2 −1
  61. arch/xtensa/kernel/irq.c +0 −5
  62. arch/xtensa/kernel/setup.c +1 −2
  63. arch/xtensa/kernel/vmlinux.lds.S +3 −3
  64. arch/xtensa/platforms/iss/simdisk.c +1 −2
  65. arch/xtensa/platforms/xtfpga/include/platform/hardware.h +4 −2
  66. arch/xtensa/platforms/xtfpga/setup.c +5 −5
  67. block/bfq-cgroup.c +93 −23
  68. block/bfq-iosched.c +1 −1
  69. block/bfq-iosched.h +11 −12
  70. block/bio-integrity.c +3 −0
  71. block/blk-mq.c +17 −8
  72. block/blk-throttle.c +18 −4
  73. crypto/asymmetric_keys/public_key.c +1 −1
  74. crypto/asymmetric_keys/verify_pefile.c +2 −2
  75. crypto/asymmetric_keys/x509_cert_parser.c +1 −0
  76. crypto/drbg.c +2 −3
  77. crypto/gcm.c +2 −4
  78. drivers/acpi/acpica/tbutils.c +25 −9
  79. drivers/acpi/acpica/utresrc.c +0 −9
  80. drivers/acpi/arm64/iort.c +14 −8
  81. drivers/acpi/battery.c +1 −1
  82. drivers/acpi/button.c +2 −3
  83. drivers/acpi/device_pm.c +1 −2
  84. drivers/acpi/scan.c +2 −2
  85. drivers/acpi/sleep.c +0 −28
  86. drivers/base/power/main.c +5 −0
  87. drivers/base/power/wakeup.c +6 −12
  88. drivers/block/loop.c +3 −0
  89. drivers/char/mem.c +1 −1
  90. drivers/char/random.c +43 −6
  91. drivers/cpufreq/cpufreq_conservative.c +2 −2
  92. drivers/cpufreq/intel_pstate.c +3 −2
  93. drivers/cpuidle/dt_idle_states.c +3 −1
  94. drivers/dax/super.c +7 −2
  95. drivers/devfreq/event/exynos-nocp.c +5 −1
  96. drivers/devfreq/event/exynos-ppmu.c +6 −2
  97. drivers/firmware/efi/efi-bgrt.c +25 −1
  98. drivers/firmware/google/vpd.c +4 −4
  99. drivers/gpio/gpio-aspeed.c +3 −0
  100. drivers/gpio/gpio-crystalcove.c +36 −18
  101. drivers/gpio/gpio-mvebu.c +8 −1
  102. drivers/gpu/drm/drm_atomic_helper.c +11 −0
  103. drivers/gpu/drm/drm_drv.c +6 −1
  104. drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c +1 −1
  105. drivers/gpu/drm/i915/i915_drv.c +9 −0
  106. drivers/gpu/drm/i915/i915_drv.h +10 −0
  107. drivers/gpu/drm/i915/i915_gem.c +4 −0
  108. drivers/gpu/drm/i915/i915_gem_gtt.c +105 −1
  109. drivers/gpu/drm/i915/i915_gem_tiling.c +1 −1
  110. drivers/gpu/drm/i915/i915_pci.c +1 −2
  111. drivers/gpu/drm/i915/intel_display.c +9 −0
  112. drivers/gpu/drm/i915/intel_engine_cs.c +17 −3
  113. drivers/gpu/drm/i915/intel_fbc.c +7 −12
  114. drivers/gpu/drm/i915/intel_pm.c +9 −0
  115. drivers/gpu/drm/i915/intel_psr.c +3 −2
  116. drivers/gpu/drm/i915/intel_sprite.c +21 −0
  117. drivers/gpu/drm/i915/intel_uc.h +0 −2
  118. drivers/gpu/drm/imx/imx-ldb.c +1 −1
  119. drivers/gpu/drm/mediatek/mtk_dsi.c +6 −9
  120. drivers/gpu/drm/mediatek/mtk_hdmi.c +1 −1
  121. drivers/gpu/drm/meson/meson_drv.c +15 −5
  122. drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h +1 −0
  123. drivers/gpu/drm/nouveau/nouveau_drm.c +17 −21
  124. drivers/gpu/drm/nouveau/nouveau_drv.h +1 −2
  125. drivers/gpu/drm/nouveau/nouveau_vga.c +2 −11
  126. drivers/gpu/drm/nouveau/nv50_display.c +2 −1
  127. drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c +4 −3
  128. drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0 −12
  129. drivers/gpu/drm/rockchip/cdn-dp-core.c +2 −7
  130. drivers/gpu/drm/rockchip/rockchip_drm_vop.c +8 −0
  131. drivers/gpu/drm/rockchip/rockchip_drm_vop.h +3 −0
  132. drivers/gpu/drm/rockchip/rockchip_vop_reg.c +2 −0
  133. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +2 −2
  134. drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +2 −0
  135. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 −114
  136. drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +0 −15
  137. drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +22 −5
  138. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +15 −8
  139. drivers/gpu/ipu-v3/ipu-common.c +8 −7
  140. drivers/gpu/ipu-v3/ipu-pre.c +5 −8
  141. drivers/hid/hid-core.c +221 −61
  142. drivers/hsi/clients/ssi_protocol.c +1 −1
  143. drivers/iio/adc/bcm_iproc_adc.c +4 −4
  144. drivers/iio/adc/max9611.c +5 −5
  145. drivers/iio/adc/sun4i-gpadc-iio.c +24 −14
  146. drivers/iio/adc/ti_am335x_adc.c +1 −1
  147. drivers/iio/industrialio-trigger.c +2 −1
  148. drivers/iio/light/ltr501.c +2 −2
  149. drivers/iio/proximity/as3935.c +6 −8
  150. drivers/infiniband/sw/rxe/rxe.h +4 −1
  151. drivers/input/mouse/elantech.c +16 −0
  152. drivers/input/rmi4/rmi_f03.c +1 −1
  153. drivers/iommu/of_iommu.c +7 −0
  154. drivers/irqchip/irq-xtensa-mx.c +1 −1
  155. drivers/irqchip/irq-xtensa-pic.c +1 −1
  156. drivers/md/md.c +12 −4
  157. drivers/md/md.h +1 −0
  158. drivers/md/raid1.c +2 −0
  159. drivers/md/raid10.c +3 −0
  160. drivers/md/raid5.c +3 −0
  161. drivers/media/cec/Kconfig +1 −0
  162. drivers/media/cec/cec-api.c +1 −7
  163. drivers/media/i2c/tc358743.c +1 −1
  164. drivers/media/rc/sir_ir.c +6 −0
  165. drivers/media/usb/rainshadow-cec/rainshadow-cec.c +1 −0
  166. drivers/media/v4l2-core/videobuf2-core.c +1 −1
  167. drivers/memory/atmel-ebi.c +1 −1
  168. drivers/misc/cxl/file.c +2 −5
  169. drivers/misc/cxl/native.c +11 −3
  170. drivers/misc/mei/bus.c +3 −1
  171. drivers/net/bonding/bond_3ad.c +27 −0
  172. drivers/net/bonding/bond_main.c +3 −3
  173. drivers/net/caif/caif_hsi.c +1 −1
  174. drivers/net/caif/caif_serial.c +1 −1
  175. drivers/net/caif/caif_spi.c +1 −1
  176. drivers/net/caif/caif_virtio.c +1 −1
  177. drivers/net/can/dev.c +3 −0
  178. drivers/net/can/peak_canfd/peak_canfd.c +1 −1
  179. drivers/net/can/slcan.c +3 −4
  180. drivers/net/can/usb/gs_usb.c +2 −0
  181. drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 −3
  182. drivers/net/can/vcan.c +2 −2
  183. drivers/net/can/vxcan.c +2 −2
  184. drivers/net/dummy.c +2 −2
  185. drivers/net/ethernet/amazon/ena/ena_com.c +21 −14
  186. drivers/net/ethernet/amazon/ena/ena_ethtool.c +1 −1
  187. drivers/net/ethernet/amazon/ena/ena_netdev.c +132 −47
  188. drivers/net/ethernet/amazon/ena/ena_netdev.h +15 −3
  189. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +0 −3
  190. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +15 −4
  191. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +13 −2
  192. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 −0
  193. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 −1
  194. drivers/net/ethernet/ibm/emac/core.c +40 −27
  195. drivers/net/ethernet/ibm/ibmvnic.c +6 −0
  196. drivers/net/ethernet/intel/i40e/i40e.h +1 −0
  197. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 −2
  198. drivers/net/ethernet/intel/i40e/i40e_main.c +4 −3
  199. drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 −2
  200. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 −0
  201. drivers/net/ethernet/marvell/mvpp2.c +33 −43
  202. drivers/net/ethernet/mellanox/mlx5/core/en.h +5 −3
  203. drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c +26 −19
  204. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +2 −9
  205. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 −1
  206. drivers/net/ethernet/mellanox/mlx5/core/health.c +5 −6
  207. drivers/net/ethernet/mellanox/mlx5/core/main.c +4 −2
  208. drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +7 −4
  209. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +17 −8
  210. drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +2 −1
  211. drivers/net/geneve.c +1 −1
  212. drivers/net/gtp.c +1 −1
  213. drivers/net/hamradio/6pack.c +1 −1
  214. drivers/net/hamradio/bpqether.c +1 −1
  215. drivers/net/hyperv/hyperv_net.h +3 −2
  216. drivers/net/hyperv/netvsc_drv.c +18 −36
  217. drivers/net/hyperv/rndis_filter.c +29 −1
  218. drivers/net/ifb.c +2 −2
  219. drivers/net/ipvlan/ipvlan_main.c +1 −1
  220. drivers/net/loopback.c +2 −2
  221. drivers/net/macsec.c +2 −2
  222. drivers/net/macvlan.c +1 −1
  223. drivers/net/netconsole.c +1 −1
  224. drivers/net/nlmon.c +1 −1
  225. drivers/net/phy/Kconfig +1 −0
  226. drivers/net/phy/phy.c +2 −0
  227. drivers/net/slip/slip.c +3 −4
  228. drivers/net/team/team.c +2 −2
  229. drivers/net/tun.c +2 −2
  230. drivers/net/usb/cdc-phonet.c +1 −1
  231. drivers/net/usb/qmi_wwan.c +5 −1
  232. drivers/net/usb/r8152.c +2 −0
  233. drivers/net/veth.c +2 −2
  234. drivers/net/vrf.c +33 −5
  235. drivers/net/vsockmon.c +1 −1
  236. drivers/net/vxlan.c +1 −1
  237. drivers/net/wan/dlci.c +1 −1
  238. drivers/net/wan/hdlc_fr.c +1 −1
  239. drivers/net/wan/lapbether.c +1 −1
  240. drivers/net/wireless/ath/ath6kl/main.c +1 −1
  241. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 −1
  242. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +2 −1
  243. drivers/net/wireless/intersil/hostap/hostap_main.c +1 −1
  244. drivers/net/wireless/mac80211_hwsim.c +1 −1
  245. drivers/net/wireless/marvell/mwifiex/main.c +1 −1
  246. drivers/net/wireless/quantenna/qtnfmac/core.c +1 −1
  247. drivers/nvme/host/core.c +14 −7
  248. drivers/nvme/host/fc.c +18 −2
  249. drivers/nvme/host/pci.c +6 −7
  250. drivers/nvme/host/rdma.c +29 −15
  251. drivers/of/device.c +2 −2
  252. drivers/phy/phy-qcom-qmp.c +7 −7
  253. drivers/platform/goldfish/goldfish_pipe.c +1 −1
  254. drivers/reset/hisilicon/hi6220_reset.c +2 −0
  255. drivers/s390/cio/vfio_ccw_ops.c +6 −6
  256. drivers/s390/crypto/ap_bus.c +24 −14
  257. drivers/s390/crypto/ap_card.c +8 −1
  258. drivers/s390/crypto/ap_queue.c +8 −1
  259. drivers/s390/net/netiucv.c +2 −2
  260. drivers/scsi/bnx2fc/bnx2fc.h +1 −0
  261. drivers/scsi/bnx2fc/bnx2fc_fcoe.c +8 −2
  262. drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +0 −1
  263. drivers/scsi/cxgbi/libcxgbi.c +22 −7
  264. drivers/scsi/cxgbi/libcxgbi.h +1 −0
  265. drivers/scsi/lpfc/lpfc_crtn.h +1 −1
  266. drivers/scsi/lpfc/lpfc_ct.c +3 −2
  267. drivers/scsi/lpfc/lpfc_nportdisc.c +5 −2
  268. drivers/scsi/lpfc/lpfc_nvmet.c +2 −2
  269. drivers/scsi/qla2xxx/qla_bsg.c +5 −4
  270. drivers/scsi/qla2xxx/qla_dbg.c +2 −2
  271. drivers/scsi/qla2xxx/qla_def.h +1 −0
  272. drivers/scsi/qla2xxx/qla_init.c +4 −1
  273. drivers/scsi/qla2xxx/qla_inline.h +7 −19
  274. drivers/scsi/qla2xxx/qla_isr.c +1 −1
  275. drivers/scsi/qla2xxx/qla_mbx.c +2 −11
  276. drivers/scsi/qla2xxx/qla_os.c +29 −17
  277. drivers/scsi/qla2xxx/qla_target.c +5 −3
  278. drivers/scsi/qla2xxx/qla_tmpl.c +1 −1
  279. drivers/scsi/scsi_debug.c +1 −1
  280. drivers/staging/ccree/Kconfig +1 −1
  281. drivers/staging/ccree/ssi_buffer_mgr.c +2 −1
  282. drivers/staging/lustre/lustre/lov/lov_pack.c +0 −9
  283. drivers/staging/rtl8188eu/os_dep/mon.c +1 −1
  284. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +2 −1
  285. drivers/staging/rtl8723bs/os_dep/os_intfs.c +0 −2
  286. drivers/usb/chipidea/core.c +4 −1
  287. drivers/usb/chipidea/debug.c +2 −1
  288. drivers/usb/chipidea/udc.c +6 −2
  289. drivers/usb/chipidea/usbmisc_imx.c +32 −9
  290. drivers/usb/dwc2/params.c +2 −0
  291. drivers/usb/gadget/function/f_mass_storage.c +11 −2
  292. drivers/usb/gadget/function/f_phonet.c +1 −1
  293. drivers/usb/gadget/udc/renesas_usb3.c +32 −13
  294. drivers/usb/musb/musb_dsps.c +5 −0
  295. drivers/xen/privcmd.c +2 −2
  296. fs/btrfs/ctree.h +2 −2
  297. fs/btrfs/dir-item.c +1 −1
  298. fs/btrfs/disk-io.c +6 −4
  299. fs/btrfs/extent-tree.c +4 −3
  300. fs/btrfs/extent_io.c +123 −3
  301. fs/btrfs/hash.c +4 −1
  302. fs/btrfs/inode.c +3 −3
  303. fs/ext4/acl.c +4 −0
  304. fs/ext4/ext4.h +0 −2
  305. fs/ext4/extents.c +42 −43
  306. fs/ext4/file.c +16 −38
  307. fs/ext4/inline.c +2 −3
  308. fs/ext4/inode.c +22 −8
  309. fs/ext4/mballoc.c +14 −9
  310. fs/ext4/namei.c +5 −8
  311. fs/ext4/super.c +8 −9
  312. fs/ext4/xattr.c +8 −0
  313. fs/f2fs/f2fs.h +4 −1
  314. fs/jbd2/transaction.c +6 −0
  315. fs/quota/dquot.c +16 −0
  316. fs/stat.c +1 −0
  317. fs/ufs/balloc.c +25 −1
  318. fs/ufs/inode.c +12 −16
  319. fs/ufs/super.c +18 −0
  320. fs/ufs/util.h +7 −3
  321. include/acpi/actbl.h +14 −0
  322. include/linux/compiler-clang.h +2 −1
  323. include/linux/dma-iommu.h +1 −0
  324. include/linux/elevator.h +1 −1
  325. include/linux/irqchip/arm-gic-v3.h +4 −0
  326. include/linux/irqchip/arm-gic.h +25 −3
  327. include/linux/key.h +0 −1
  328. include/linux/netdevice.h +10 −5
  329. include/linux/quotaops.h +6 −0
  330. include/linux/srcu.h +0 −2
  331. include/linux/suspend.h +2 −5
  332. include/media/cec-notifier.h +10 −0
  333. include/media/cec.h +1 −1
  334. include/uapi/linux/ethtool.h +4 −2
  335. include/uapi/linux/keyctl.h +2 −2
  336. include/uapi/linux/openvswitch.h +1 −0
  337. kernel/cpu.c +2 −2
  338. kernel/events/core.c +21 −0
  339. kernel/power/process.c +1 −1
  340. kernel/power/suspend.c +4 −25
  341. kernel/printk/printk.c +10 −36
  342. kernel/rcu/srcu.c +2 −3
  343. kernel/rcu/srcutiny.c +4 −3
  344. kernel/rcu/srcutree.c +2 −3
  345. kernel/sched/cpufreq_schedutil.c +0 −3
  346. lib/libcrc32c.c +4 −2
  347. net/8021q/vlan_dev.c +2 −2
  348. net/batman-adv/distributed-arp-table.c +3 −2
  349. net/batman-adv/routing.c +1 −1
  350. net/batman-adv/soft-interface.c +2 −3
  351. net/bluetooth/6lowpan.c +1 −1
  352. net/bridge/br_device.c +1 −1
  353. net/caif/caif_socket.c +4 −0
  354. net/caif/cfpkt_skbuff.c +1 −5
  355. net/caif/chnl_net.c +2 −2
  356. net/can/af_can.c +1 −2
  357. net/core/dev.c +30 −12
  358. net/core/dst.c +14 −0
  359. net/core/rtnetlink.c +2 −1
  360. net/decnet/netfilter/dn_rtmsg.c +3 −1
  361. net/hsr/hsr_device.c +2 −2
  362. net/hsr/hsr_forward.c +1 −2
  363. net/hsr/hsr_framereg.c +7 −2
  364. net/hsr/hsr_framereg.h +1 −1
  365. net/ieee802154/6lowpan/core.c +1 −1
  366. net/ipv4/icmp.c +6 −2
  367. net/ipv4/igmp.c +13 −8
  368. net/ipv4/ip_tunnel.c +2 −2
  369. net/ipv4/ipmr.c +16 −18
  370. net/ipv6/icmp.c +1 −1
  371. net/ipv6/ila/ila_xlat.c +1 −0
  372. net/ipv6/ip6_gre.c +5 −4
  373. net/ipv6/ip6_tunnel.c +4 −4
  374. net/ipv6/ip6_vti.c +4 −4
  375. net/ipv6/ip6mr.c +1 −1
  376. net/ipv6/proc.c +1 −1
  377. net/ipv6/route.c +1 −0
  378. net/ipv6/sit.c +3 −3
  379. net/irda/irlan/irlan_eth.c +1 −1
  380. net/l2tp/l2tp_eth.c +8 −7
  381. net/mac80211/cfg.c +2 −0
  382. net/mac80211/ieee80211_i.h +1 −1
  383. net/mac80211/iface.c +4 −3
  384. net/mac80211/mlme.c +31 −31
  385. net/mac80211/rx.c +5 −1
  386. net/mac80211/wpa.c +5 −4
  387. net/mac802154/iface.c +3 −4
  388. net/openvswitch/vport-internal_dev.c +2 −2
  389. net/phonet/pep-gprs.c +1 −1
  390. net/sched/act_pedit.c +3 −1
  391. net/sched/act_police.c +3 −5
  392. net/sctp/socket.c +2 −2
  393. net/tipc/msg.c +1 −1
  394. net/unix/af_unix.c +6 −1
  395. security/keys/Kconfig +5 −1
  396. security/keys/dh.c +184 −116
  397. security/keys/encrypted-keys/encrypted.c +74 −130
  398. security/keys/gc.c +1 −3
  399. security/keys/key.c +6 −10
  400. security/keys/keyctl.c +11 −5
  401. security/keys/keyring.c +6 −6
  402. security/keys/process_keys.c +4 −3
  403. security/keys/trusted.c +22 −28
  404. security/keys/user_defined.c +12 −4
  405. sound/core/timer.c +5 −2
  406. sound/pci/hda/patch_realtek.c +6 −5
  407. sound/soc/atmel/atmel-classd.c +9 −0
  408. sound/soc/codecs/da7213.c +1 −1
  409. sound/soc/codecs/rt286.c +7 −0
  410. sound/soc/generic/simple-card.c +1 −1
  411. sound/soc/intel/skylake/skl-sst-ipc.c +5 −0
  412. sound/soc/intel/skylake/skl-topology.c +1 −1
  413. sound/soc/intel/skylake/skl.c +88 −74
  414. sound/soc/intel/skylake/skl.h +3 −1
  415. sound/soc/sh/rcar/adg.c +4 −2
  416. sound/soc/sh/rcar/cmd.c +1 −0
  417. sound/soc/sh/rcar/core.c +51 −0
  418. sound/soc/sh/rcar/gen.c +1 −0
  419. sound/soc/sh/rcar/rsnd.h +2 −0
  420. sound/soc/sh/rcar/src.c +10 −2
  421. sound/soc/sh/rcar/ssi.c +15 −3
  422. sound/soc/sh/rcar/ssiu.c +2 −1
  423. sound/soc/soc-core.c +3 −2
  424. tools/perf/Documentation/perf-probe.txt +6 −2
  425. tools/perf/Documentation/perf-script-perl.txt +1 −1
  426. tools/perf/Documentation/perf-script-python.txt +9 −14
  427. tools/perf/arch/common.c +1 −0
  428. tools/perf/builtin-stat.c +4 −1
  429. tools/perf/builtin-trace.c +4 −0
  430. tools/perf/tests/bp_signal.c +14 −0
  431. tools/perf/tests/builtin-test.c +7 −0
  432. tools/perf/tests/code-reading.c +19 −1
  433. tools/perf/tests/tests.h +3 −0
  434. tools/perf/util/annotate.c +43 −29
  435. tools/perf/util/build-id.c +0 −45
  436. tools/perf/util/build-id.h +0 −1
  437. tools/perf/util/dso.c +94 −6
  438. tools/perf/util/dso.h +9 −0
  439. tools/perf/util/header.c +10 −2
  440. tools/perf/util/machine.c +1 −10
  441. tools/perf/util/scripting-engines/trace-event-python.c +1 −1
  442. tools/perf/util/symbol-elf.c +3 −38
  443. tools/perf/util/symbol.c +0 −4
  444. tools/perf/util/unwind-libdw.c +9 −1
  445. tools/testing/selftests/bpf/bpf_endian.h +30 −11
  446. virt/kvm/arm/hyp/vgic-v3-sr.c +1 −1
  447. virt/kvm/arm/mmu.c +3 −0
  448. virt/kvm/arm/vgic/vgic-mmio-v2.c +14 −2
  449. virt/kvm/arm/vgic/vgic-v2.c +25 −3
  450. virt/kvm/arm/vgic/vgic-v3.c +33 −14
  451. virt/kvm/arm/vgic/vgic.h +8 −4
Documentation/admin-guide/kernel-parameters.txt+9−0
@@ -866,6 +866,15 @@ · 865 unmodified lines
866866
867867 dscc4.setup= [NET]
868868
869+ dt_cpu_ftrs= [PPC]
870+ Format: {"off" | "known"}
871+ Control how the dt_cpu_ftrs device-tree binding is
872+ used for CPU feature discovery and setup (if it
873+ exists).
874+ off: Do not use it, fall back to legacy cpu table.
875+ known: Do not pass through unknown features to guests
876+ or userspace, only those that the kernel is aware of.
877+
869878 dump_apple_properties [X86]
870879 Dump name and content of EFI device properties on
871880 x86 Macs. Useful for driver authors to determine
Documentation/devicetree/bindings/usb/dwc2.txt+1−0
@@ -10,6 +10,7 @@ Required properties: · 9 unmodified lines
1010 - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc;
1111 - "lantiq,arx100-usb": The DWC2 USB controller instance in Lantiq ARX SoCs;
1212 - "lantiq,xrx200-usb": The DWC2 USB controller instance in Lantiq XRX SoCs;
13+ - "amlogic,meson8-usb": The DWC2 USB controller instance in Amlogic Meson8 SoCs;
1314 - "amlogic,meson8b-usb": The DWC2 USB controller instance in Amlogic Meson8b SoCs;
1415 - "amlogic,meson-gxbb-usb": The DWC2 USB controller instance in Amlogic S905 SoCs;
1516 - "amcc,dwc-otg": The DWC2 USB controller instance in AMCC Canyonlands 460EX SoCs;
Documentation/networking/scaling.txt+1−1
@@ -122,7 +122,7 @@ associated flow of the packet. The hash is either provided by hardware · 121 unmodified lines
122122 or will be computed in the stack. Capable hardware can pass the hash in
123123 the receive descriptor for the packet; this would usually be the same
124124 hash used for RSS (e.g. computed Toeplitz hash). The hash is saved in
125−skb->rx_hash and can be used elsewhere in the stack as a hash of the
125+skb->hash and can be used elsewhere in the stack as a hash of the
126126 packet’s flow.
127127
128128 Each receive hardware queue has an associated list of CPUs to which
MAINTAINERS+11−12
@@ -1172,7 +1172,7 @@ N: clps711x · 1171 unmodified lines
11721172
11731173 ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
11741174 M: Hartley Sweeten <hsweeten@visionengravers.com>
1175−M: Ryan Mallon <rmallon@gmail.com>
1175+M: Alexander Sverdlin <alexander.sverdlin@gmail.com>
11761176 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
11771177 S: Maintained
11781178 F: arch/arm/mach-ep93xx/
@@ -1489,13 +1489,15 @@ M: Gregory Clement <gregory.clement@free-electrons.com> · 310 unmodified lines
14891489 M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
14901490 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
14911491 S: Maintained
1492−F: arch/arm/mach-mvebu/
1493−F: drivers/rtc/rtc-armada38x.c
14941492 F: arch/arm/boot/dts/armada*
14951493 F: arch/arm/boot/dts/kirkwood*
1494+F: arch/arm/configs/mvebu_*_defconfig
1495+F: arch/arm/mach-mvebu/
14961496 F: arch/arm64/boot/dts/marvell/armada*
14971497 F: drivers/cpufreq/mvebu-cpufreq.c
1498−F: arch/arm/configs/mvebu_*_defconfig
1498+F: drivers/irqchip/irq-armada-370-xp.c
1499+F: drivers/irqchip/irq-mvebu-*
1500+F: drivers/rtc/rtc-armada38x.c
14991501
15001502 ARM/Marvell Berlin SoC support
15011503 M: Jisheng Zhang <jszhang@marvell.com>
@@ -1721,7 +1723,6 @@ N: rockchip · 219 unmodified lines
17211723 ARM/SAMSUNG EXYNOS ARM ARCHITECTURES
17221724 M: Kukjin Kim <kgene@kernel.org>
17231725 M: Krzysztof Kozlowski <krzk@kernel.org>
1724−R: Javier Martinez Canillas <javier@osg.samsung.com>
17251726 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
17261727 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
17271728 Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/
@@ -1829,7 +1830,6 @@ F: drivers/edac/altera_edac. · 101 unmodified lines
18291830 ARM/STI ARCHITECTURE
18301831 M: Patrice Chotard <patrice.chotard@st.com>
18311832 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1832−L: kernel@stlinux.com
18331833 W: http://www.stlinux.com
18341834 S: Maintained
18351835 F: arch/arm/mach-sti/
@@ -5622,7 +5622,7 @@ F: scripts/get_maintainer.pl · 3786 unmodified lines
56225622
56235623 GENWQE (IBM Generic Workqueue Card)
56245624 M: Frank Haverkamp <haver@linux.vnet.ibm.com>
5625−M: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
5625+M: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
56265626 S: Supported
56275627 F: drivers/misc/genwqe/
56285628
@@ -5667,7 +5667,6 @@ F: tools/testing/selftests/gpio/ · 38 unmodified lines
56675667
56685668 GPIO SUBSYSTEM
56695669 M: Linus Walleij <linus.walleij@linaro.org>
5670−M: Alexandre Courbot <gnurou@gmail.com>
56715670 L: linux-gpio@vger.kernel.org
56725671 T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
56735672 S: Maintained
@@ -7708,7 +7707,7 @@ F: drivers/platform/x86/hp_accel.c · 2034 unmodified lines
77087707
77097708 LIVE PATCHING
77107709 M: Josh Poimboeuf <jpoimboe@redhat.com>
7711−M: Jessica Yu <jeyu@redhat.com>
7710+M: Jessica Yu <jeyu@kernel.org>
77127711 M: Jiri Kosina <jikos@kernel.org>
77137712 M: Miroslav Benes <mbenes@suse.cz>
77147713 R: Petr Mladek <pmladek@suse.com>
@@ -8623,7 +8622,7 @@ S: Maintained · 908 unmodified lines
86238622 F: drivers/media/dvb-frontends/mn88473*
86248623
86258624 MODULE SUPPORT
8626−M: Jessica Yu <jeyu@redhat.com>
8625+M: Jessica Yu <jeyu@kernel.org>
86278626 M: Rusty Russell <rusty@rustcorp.com.au>
86288627 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
86298628 S: Maintained
@@ -11311,7 +11310,6 @@ F: drivers/media/rc/serial_ir.c · 2681 unmodified lines
1131111310
1131211311 STI CEC DRIVER
1131311312 M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11314−L: kernel@stlinux.com
1131511313 S: Maintained
1131611314 F: drivers/staging/media/st-cec/
1131711315 F: Documentation/devicetree/bindings/media/stih-cec.txt
@@ -11821,6 +11819,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git · 503 unmodified lines
1182111819 S: Supported
1182211820 F: arch/arm/mach-davinci/
1182311821 F: drivers/i2c/busses/i2c-davinci.c
11822+F: arch/arm/boot/dts/da850*
1182411823
1182511824 TI DAVINCI SERIES MEDIA DRIVER
1182611825 M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
@@ -13904,7 +13903,7 @@ S: Odd fixes · 2077 unmodified lines
1390413903 F: drivers/net/wireless/wl3501*
1390513904
1390613905 WOLFSON MICROELECTRONICS DRIVERS
13907−L: patches@opensource.wolfsonmicro.com
13906+L: patches@opensource.cirrus.com
1390813907 T: git https://github.com/CirrusLogic/linux-drivers.git
1390913908 W: https://github.com/CirrusLogic/linux-drivers/wiki
1391013909 S: Supported
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 12
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc4
4+EXTRAVERSION = -rc5
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
arch/arm/boot/dts/bcm283x.dtsi+5−0
@@ -3,6 +3,11 @@ · 2 unmodified lines
33 #include <dt-bindings/clock/bcm2835-aux.h>
44 #include <dt-bindings/gpio/gpio.h>
55
6+/* firmware-provided startup stubs live here, where the secondary CPUs are
7+ * spinning.
8+ */
9+/memreserve/ 0x00000000 0x00001000;
10+
611 /* This include file covers the common peripherals and configuration between
712 * bcm2835 and bcm2836 implementations, leaving the CPU configuration to
813 * bcm2835.dtsi and bcm2836.dtsi.
arch/arm/boot/dts/keystone-k2l-netcp.dtsi+2−2
@@ -137,8 +137,8 @@ netcp: netcp@26000000 { · 136 unmodified lines
137137 /* NetCP address range */
138138 ranges = <0 0x26000000 0x1000000>;
139139
140− clocks = <&clkpa>, <&clkcpgmac>, <&chipclk12>, <&clkosr>;
141− clock-names = "pa_clk", "ethss_clk", "cpts", "osr_clk";
140+ clocks = <&clkpa>, <&clkcpgmac>, <&chipclk12>;
141+ clock-names = "pa_clk", "ethss_clk", "cpts";
142142 dma-coherent;
143143
144144 ti,navigator-dmas = <&dma_gbe 0>,
arch/arm/boot/dts/keystone-k2l.dtsi+8−0
@@ -232,6 +232,14 @@ · 231 unmodified lines
232232 };
233233 };
234234
235+ osr: sram@70000000 {
236+ compatible = "mmio-sram";
237+ reg = <0x70000000 0x10000>;
238+ #address-cells = <1>;
239+ #size-cells = <1>;
240+ clocks = <&clkosr>;
241+ };
242+
235243 dspgpio0: keystone_dsp_gpio@02620240 {
236244 compatible = "ti,keystone-dsp-gpio";
237245 gpio-controller;
arch/arm/boot/dts/versatile-pb.dts+1−1
@@ -1,4 +1,4 @@
1−#include <versatile-ab.dts>
1+#include "versatile-ab.dts"
22
33 / {
44 model = "ARM Versatile PB";
arch/arm/include/asm/device.h+2−1
@@ -19,7 +19,8 @@ struct dev_archdata { · 18 unmodified lines
1919 #ifdef CONFIG_XEN
2020 const struct dma_map_ops *dev_dma_ops;
2121 #endif
22− bool dma_coherent;
22+ unsigned int dma_coherent:1;
23+ unsigned int dma_ops_setup:1;
2324 };
2425
2526 struct omap_device;
arch/arm/kvm/init.S+2−3
@@ -104,7 +104,6 @@ __do_hyp_init: · 103 unmodified lines
104104 @ - Write permission implies XN: disabled
105105 @ - Instruction cache: enabled
106106 @ - Data/Unified cache: enabled
107− @ - Memory alignment checks: enabled
108107 @ - MMU: enabled (this code must be run from an identity mapping)
109108 mrc p15, 4, r0, c1, c0, 0 @ HSCR
110109 ldr r2, =HSCTLR_MASK
@@ -112,8 +111,8 @@ __do_hyp_init: · 1 unmodified line
112111 mrc p15, 0, r1, c1, c0, 0 @ SCTLR
113112 ldr r2, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C)
114113 and r1, r1, r2
115− ARM( ldr r2, =(HSCTLR_M | HSCTLR_A) )
116− THUMB( ldr r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE) )
114+ ARM( ldr r2, =(HSCTLR_M) )
115+ THUMB( ldr r2, =(HSCTLR_M | HSCTLR_TE) )
117116 orr r1, r1, r2
118117 orr r0, r0, r1
119118 mcr p15, 4, r0, c1, c0, 0 @ HSCR
arch/arm/mach-at91/Kconfig+1−0
@@ -1,6 +1,7 @@
11 menuconfig ARCH_AT91
22 bool "Atmel SoCs"
33 depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7
4+ select ARM_CPU_SUSPEND if PM
45 select COMMON_CLK_AT91
56 select GPIOLIB
67 select PINCTRL
arch/arm/mach-davinci/pm.c+6−1
@@ -153,7 +153,8 @@ int __init davinci_pm_init(void) · 152 unmodified lines
153153 davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL);
154154 if (!davinci_sram_suspend) {
155155 pr_err("PM: cannot allocate SRAM memory\n");
156− return -ENOMEM;
156+ ret = -ENOMEM;
157+ goto no_sram_mem;
157158 }
158159
159160 davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend,
@@ -161,6 +162,10 @@ int __init davinci_pm_init(void) · 1 unmodified line
161162
162163 suspend_set_ops(&davinci_pm_ops);
163164
165+ return 0;
166+
167+no_sram_mem:
168+ iounmap(pm_config.ddrpsc_reg_base);
164169 no_ddrpsc_mem:
165170 iounmap(pm_config.ddrpll_reg_base);
166171 no_ddrpll_mem:
arch/arm/mm/dma-mapping.c+14−15
@@ -2311,7 +2311,14 @@ int arm_iommu_attach_device(struct device *dev, · 2310 unmodified lines
23112311 }
23122312 EXPORT_SYMBOL_GPL(arm_iommu_attach_device);
23132313
2314−static void __arm_iommu_detach_device(struct device *dev)
2314+/**
2315+ * arm_iommu_detach_device
2316+ * @dev: valid struct device pointer
2317+ *
2318+ * Detaches the provided device from a previously attached map.
2319+ * This voids the dma operations (dma_map_ops pointer)
2320+ */
2321+void arm_iommu_detach_device(struct device *dev)
23152322 {
23162323 struct dma_iommu_mapping *mapping;
23172324
@@ -2324,22 +2331,10 @@ static void __arm_iommu_detach_device(struct device *dev) · 6 unmodified lines
23242331 iommu_detach_device(mapping->domain, dev);
23252332 kref_put(&mapping->kref, release_iommu_mapping);
23262333 to_dma_iommu_mapping(dev) = NULL;
2334+ set_dma_ops(dev, NULL);
23272335
23282336 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
23292337 }
2330−
2331−/**
2332− * arm_iommu_detach_device
2333− * @dev: valid struct device pointer
2334− *
2335− * Detaches the provided device from a previously attached map.
2336− * This voids the dma operations (dma_map_ops pointer)
2337− */
2338−void arm_iommu_detach_device(struct device *dev)
2339−{
2340− __arm_iommu_detach_device(dev);
2341− set_dma_ops(dev, NULL);
2342−}
23432338 EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
23442339
23452340 static const struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
@@ -2379,7 +2374,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) · 33 unmodified lines
23792374 if (!mapping)
23802375 return;
23812376
2382− __arm_iommu_detach_device(dev);
2377+ arm_iommu_detach_device(dev);
23832378 arm_iommu_release_mapping(mapping);
23842379 }
23852380
@@ -2430,9 +2425,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 44 unmodified lines
24302425 dev->dma_ops = xen_dma_ops;
24312426 }
24322427 #endif
2428+ dev->archdata.dma_ops_setup = true;
24332429 }
24342430
24352431 void arch_teardown_dma_ops(struct device *dev)
24362432 {
2433+ if (!dev->archdata.dma_ops_setup)
2434+ return;
2435+
24372436 arm_teardown_iommu_dma_ops(dev);
24382437 }
arch/arm64/Kconfig+0−4
@@ -1084,10 +1084,6 @@ config SYSVIPC_COMPAT · 1083 unmodified lines
10841084 def_bool y
10851085 depends on COMPAT && SYSVIPC
10861086
1087−config KEYS_COMPAT
1088− def_bool y
1089− depends on COMPAT && KEYS
1090−
10911087 endmenu
10921088
10931089 menu "Power management options"
arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi+1−2
@@ -231,8 +231,7 @@ · 230 unmodified lines
231231 cpm_crypto: crypto@800000 {
232232 compatible = "inside-secure,safexcel-eip197";
233233 reg = <0x800000 0x200000>;
234− interrupts = <GIC_SPI 34 (IRQ_TYPE_EDGE_RISING
235− | IRQ_TYPE_LEVEL_HIGH)>,
234+ interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
236235 <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
237236 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
238237 <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi+1−2
@@ -221,8 +221,7 @@ · 220 unmodified lines
221221 cps_crypto: crypto@800000 {
222222 compatible = "inside-secure,safexcel-eip197";
223223 reg = <0x800000 0x200000>;
224− interrupts = <GIC_SPI 34 (IRQ_TYPE_EDGE_RISING
225− | IRQ_TYPE_LEVEL_HIGH)>,
224+ interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
226225 <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>,
227226 <GIC_SPI 279 IRQ_TYPE_LEVEL_HIGH>,
228227 <GIC_SPI 280 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/configs/defconfig+10−0
@@ -68,6 +68,7 @@ CONFIG_PCIE_QCOM=y · 67 unmodified lines
6868 CONFIG_PCIE_ARMADA_8K=y
6969 CONFIG_PCI_AARDVARK=y
7070 CONFIG_PCIE_RCAR=y
71+CONFIG_PCIE_ROCKCHIP=m
7172 CONFIG_PCI_HOST_GENERIC=y
7273 CONFIG_PCI_XGENE=y
7374 CONFIG_ARM64_VA_BITS_48=y
@@ -209,6 +210,8 @@ CONFIG_BRCMFMAC=m · 135 unmodified lines
209210 CONFIG_WL18XX=m
210211 CONFIG_WLCORE_SDIO=m
211212 CONFIG_INPUT_EVDEV=y
213+CONFIG_KEYBOARD_ADC=m
214+CONFIG_KEYBOARD_CROS_EC=y
212215 CONFIG_KEYBOARD_GPIO=y
213216 CONFIG_INPUT_MISC=y
214217 CONFIG_INPUT_PM8941_PWRKEY=y
@@ -264,6 +267,7 @@ CONFIG_SPI_MESON_SPIFC=m · 49 unmodified lines
264267 CONFIG_SPI_ORION=y
265268 CONFIG_SPI_PL022=y
266269 CONFIG_SPI_QUP=y
270+CONFIG_SPI_ROCKCHIP=y
267271 CONFIG_SPI_S3C64XX=y
268272 CONFIG_SPI_SPIDEV=m
269273 CONFIG_SPMI=y
@@ -293,6 +297,7 @@ CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y · 23 unmodified lines
293297 CONFIG_CPU_THERMAL=y
294298 CONFIG_THERMAL_EMULATION=y
295299 CONFIG_EXYNOS_THERMAL=y
300+CONFIG_ROCKCHIP_THERMAL=m
296301 CONFIG_WATCHDOG=y
297302 CONFIG_S3C2410_WATCHDOG=y
298303 CONFIG_MESON_GXBB_WATCHDOG=m
@@ -301,12 +306,14 @@ CONFIG_RENESAS_WDT=y · 2 unmodified lines
301306 CONFIG_BCM2835_WDT=y
302307 CONFIG_MFD_CROS_EC=y
303308 CONFIG_MFD_CROS_EC_I2C=y
309+CONFIG_MFD_CROS_EC_SPI=y
304310 CONFIG_MFD_EXYNOS_LPASS=m
305311 CONFIG_MFD_HI655X_PMIC=y
306312 CONFIG_MFD_MAX77620=y
307313 CONFIG_MFD_SPMI_PMIC=y
308314 CONFIG_MFD_RK808=y
309315 CONFIG_MFD_SEC_CORE=y
316+CONFIG_REGULATOR_FAN53555=y
310317 CONFIG_REGULATOR_FIXED_VOLTAGE=y
311318 CONFIG_REGULATOR_GPIO=y
312319 CONFIG_REGULATOR_HI655X=y
@@ -474,8 +481,10 @@ CONFIG_ARCH_TEGRA_186_SOC=y · 161 unmodified lines
474481 CONFIG_EXTCON_USB_GPIO=y
475482 CONFIG_IIO=y
476483 CONFIG_EXYNOS_ADC=y
484+CONFIG_ROCKCHIP_SARADC=m
477485 CONFIG_PWM=y
478486 CONFIG_PWM_BCM2835=m
487+CONFIG_PWM_CROS_EC=m
479488 CONFIG_PWM_MESON=m
480489 CONFIG_PWM_ROCKCHIP=y
481490 CONFIG_PWM_SAMSUNG=y
@@ -485,6 +494,7 @@ CONFIG_PHY_HI6220_USB=y · 3 unmodified lines
485494 CONFIG_PHY_SUN4I_USB=y
486495 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
487496 CONFIG_PHY_ROCKCHIP_EMMC=y
497+CONFIG_PHY_ROCKCHIP_PCIE=m
488498 CONFIG_PHY_XGENE=y
489499 CONFIG_PHY_TEGRA_XUSB=y
490500 CONFIG_ARM_SCPI_PROTOCOL=y
arch/arm64/include/asm/sysreg.h+4−0
@@ -286,6 +286,10 @@ · 285 unmodified lines
286286 #define SCTLR_ELx_A (1 << 1)
287287 #define SCTLR_ELx_M 1
288288
289+#define SCTLR_EL2_RES1 ((1 << 4) | (1 << 5) | (1 << 11) | (1 << 16) | \
290+ (1 << 16) | (1 << 18) | (1 << 22) | (1 << 23) | \
291+ (1 << 28) | (1 << 29))
292+
289293 #define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \
290294 SCTLR_ELx_SA | SCTLR_ELx_I)
291295
arch/arm64/kvm/hyp-init.S+7−4
@@ -106,10 +106,13 @@ __do_hyp_init: · 105 unmodified lines
106106 tlbi alle2
107107 dsb sy
108108
109− mrs x4, sctlr_el2
110− and x4, x4, #SCTLR_ELx_EE // preserve endianness of EL2
111− ldr x5, =SCTLR_ELx_FLAGS
112− orr x4, x4, x5
109+ /*
110+ * Preserve all the RES1 bits while setting the default flags,
111+ * as well as the EE bit on BE. Drop the A flag since the compiler
112+ * is allowed to generate unaligned accesses.
113+ */
114+ ldr x4, =(SCTLR_EL2_RES1 | (SCTLR_ELx_FLAGS & ~SCTLR_ELx_A))
115+CPU_BE( orr x4, x4, #SCTLR_ELx_EE)
113116 msr sctlr_el2, x4
114117 isb
115118
arch/arm64/kvm/vgic-sys-reg-v3.c+5−5
@@ -65,8 +65,8 @@ static bool access_gic_ctlr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 64 unmodified lines
6565 * Here set VMCR.CTLR in ICC_CTLR_EL1 layout.
6666 * The vgic_set_vmcr() will convert to ICH_VMCR layout.
6767 */
68− vmcr.ctlr = val & ICC_CTLR_EL1_CBPR_MASK;
69− vmcr.ctlr |= val & ICC_CTLR_EL1_EOImode_MASK;
68+ vmcr.cbpr = (val & ICC_CTLR_EL1_CBPR_MASK) >> ICC_CTLR_EL1_CBPR_SHIFT;
69+ vmcr.eoim = (val & ICC_CTLR_EL1_EOImode_MASK) >> ICC_CTLR_EL1_EOImode_SHIFT;
7070 vgic_set_vmcr(vcpu, &vmcr);
7171 } else {
7272 val = 0;
@@ -83,8 +83,8 @@ static bool access_gic_ctlr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 10 unmodified lines
8383 * The VMCR.CTLR value is in ICC_CTLR_EL1 layout.
8484 * Extract it directly using ICC_CTLR_EL1 reg definitions.
8585 */
86− val |= vmcr.ctlr & ICC_CTLR_EL1_CBPR_MASK;
87− val |= vmcr.ctlr & ICC_CTLR_EL1_EOImode_MASK;
86+ val |= (vmcr.cbpr << ICC_CTLR_EL1_CBPR_SHIFT) & ICC_CTLR_EL1_CBPR_MASK;
87+ val |= (vmcr.eoim << ICC_CTLR_EL1_EOImode_SHIFT) & ICC_CTLR_EL1_EOImode_MASK;
8888
8989 p->regval = val;
9090 }
@@ -135,7 +135,7 @@ static bool access_gic_bpr1(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 44 unmodified lines
135135 p->regval = 0;
136136
137137 vgic_get_vmcr(vcpu, &vmcr);
138− if (!((vmcr.ctlr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT)) {
138+ if (!vmcr.cbpr) {
139139 if (p->is_write) {
140140 vmcr.abpr = (p->regval & ICC_BPR1_EL1_MASK) >>
141141 ICC_BPR1_EL1_SHIFT;
arch/arm64/net/bpf_jit_comp.c+5−2
@@ -36,6 +36,7 @@ int bpf_jit_enable __read_mostly; · 35 unmodified lines
3636 #define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
3737 #define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
3838 #define TCALL_CNT (MAX_BPF_JIT_REG + 2)
39+#define TMP_REG_3 (MAX_BPF_JIT_REG + 3)
3940
4041 /* Map BPF registers to A64 registers */
4142 static const int bpf2a64[] = {
@@ -57,6 +58,7 @@ static const int bpf2a64[] = { · 15 unmodified lines
5758 /* temporary registers for internal BPF JIT */
5859 [TMP_REG_1] = A64_R(10),
5960 [TMP_REG_2] = A64_R(11),
61+ [TMP_REG_3] = A64_R(12),
6062 /* tail_call_cnt */
6163 [TCALL_CNT] = A64_R(26),
6264 /* temporary register for blinding constants */
@@ -319,6 +321,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 256 unmodified lines
319321 const u8 src = bpf2a64[insn->src_reg];
320322 const u8 tmp = bpf2a64[TMP_REG_1];
321323 const u8 tmp2 = bpf2a64[TMP_REG_2];
324+ const u8 tmp3 = bpf2a64[TMP_REG_3];
322325 const s16 off = insn->off;
323326 const s32 imm = insn->imm;
324327 const int i = insn - ctx->prog->insnsi;
@@ -689,10 +692,10 @@ emit_cond_jmp: · 364 unmodified lines
689692 emit(A64_PRFM(tmp, PST, L1, STRM), ctx);
690693 emit(A64_LDXR(isdw, tmp2, tmp), ctx);
691694 emit(A64_ADD(isdw, tmp2, tmp2, src), ctx);
692− emit(A64_STXR(isdw, tmp2, tmp, tmp2), ctx);
695+ emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx);
693696 jmp_offset = -3;
694697 check_imm19(jmp_offset);
695− emit(A64_CBNZ(0, tmp2, jmp_offset), ctx);
698+ emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
696699 break;
697700
698701 /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */
arch/hexagon/mm/uaccess.c+2−3
@@ -37,15 +37,14 @@ __kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count) · 36 unmodified lines
3737 long uncleared;
3838
3939 while (count > PAGE_SIZE) {
40− uncleared = __copy_to_user_hexagon(dest, &empty_zero_page,
41− PAGE_SIZE);
40+ uncleared = raw_copy_to_user(dest, &empty_zero_page, PAGE_SIZE);
4241 if (uncleared)
4342 return count - (PAGE_SIZE - uncleared);
4443 count -= PAGE_SIZE;
4544 dest += PAGE_SIZE;
4645 }
4746 if (count)
48− count = __copy_to_user_hexagon(dest, &empty_zero_page, count);
47+ count = raw_copy_to_user(dest, &empty_zero_page, count);
4948
5049 return count;
5150 }
arch/powerpc/Kconfig+0−21
@@ -380,22 +380,6 @@ source "arch/powerpc/platforms/Kconfig" · 379 unmodified lines
380380
381381 menu "Kernel options"
382382
383−config PPC_DT_CPU_FTRS
384− bool "Device-tree based CPU feature discovery & setup"
385− depends on PPC_BOOK3S_64
386− default n
387− help
388− This enables code to use a new device tree binding for describing CPU
389− compatibility and features. Saying Y here will attempt to use the new
390− binding if the firmware provides it. Currently only the skiboot
391− firmware provides this binding.
392− If you're not sure say Y.
393−
394−config PPC_CPUFEATURES_ENABLE_UNKNOWN
395− bool "cpufeatures pass through unknown features to guest/userspace"
396− depends on PPC_DT_CPU_FTRS
397− default y
398−
399383 config HIGHMEM
400384 bool "High memory support"
401385 depends on PPC32
@@ -1215,11 +1199,6 @@ source "arch/powerpc/Kconfig.debug" · 813 unmodified lines
12151199
12161200 source "security/Kconfig"
12171201
1218−config KEYS_COMPAT
1219− bool
1220− depends on COMPAT && KEYS
1221− default y
1222−
12231202 source "crypto/Kconfig"
12241203
12251204 config PPC_LIB_RHEAP
arch/powerpc/include/asm/book3s/64/hash-4k.h+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 #define H_PTE_INDEX_SIZE 9
99 #define H_PMD_INDEX_SIZE 7
1010 #define H_PUD_INDEX_SIZE 9
11−#define H_PGD_INDEX_SIZE 12
11+#define H_PGD_INDEX_SIZE 9
1212
1313 #ifndef __ASSEMBLY__
1414 #define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE)
arch/powerpc/include/asm/cputable.h+1−2
@@ -214,7 +214,6 @@ enum { · 213 unmodified lines
214214 #define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000)
215215 #define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000)
216216 #define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x1000000000000000)
217−#define CPU_FTR_SUBCORE LONG_ASM_CONST(0x2000000000000000)
218217 #define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x4000000000000000)
219218
220219 #ifndef __ASSEMBLY__
@@ -463,7 +462,7 @@ enum { · 242 unmodified lines
463462 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
464463 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
465464 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \
466− CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_SUBCORE)
465+ CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP)
467466 #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)
468467 #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)
469468 #define CPU_FTRS_POWER9 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
arch/powerpc/include/asm/processor.h+12−13
@@ -110,13 +110,18 @@ void release_thread(struct task_struct *); · 109 unmodified lines
110110 #define TASK_SIZE_128TB (0x0000800000000000UL)
111111 #define TASK_SIZE_512TB (0x0002000000000000UL)
112112
113−#ifdef CONFIG_PPC_BOOK3S_64
113+/*
114+ * For now 512TB is only supported with book3s and 64K linux page size.
115+ */
116+#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES)
114117 /*
115118 * Max value currently used:
116119 */
117−#define TASK_SIZE_USER64 TASK_SIZE_512TB
120+#define TASK_SIZE_USER64 TASK_SIZE_512TB
121+#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB
118122 #else
119−#define TASK_SIZE_USER64 TASK_SIZE_64TB
123+#define TASK_SIZE_USER64 TASK_SIZE_64TB
124+#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB
120125 #endif
121126
122127 /*
@@ -132,7 +137,7 @@ void release_thread(struct task_struct *); · 9 unmodified lines
132137 * space during mmap's.
133138 */
134139 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
135−#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4))
140+#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
136141
137142 #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \
138143 TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
@@ -143,21 +148,15 @@ void release_thread(struct task_struct *); · 4 unmodified lines
143148 * with 128TB and conditionally enable upto 512TB
144149 */
145150 #ifdef CONFIG_PPC_BOOK3S_64
146−#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \
147− TASK_SIZE_USER32 : TASK_SIZE_128TB)
151+#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \
152+ TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64)
148153 #else
149154 #define DEFAULT_MAP_WINDOW TASK_SIZE
150155 #endif
151156
152157 #ifdef __powerpc64__
153158
154−#ifdef CONFIG_PPC_BOOK3S_64
155−/* Limit stack to 128TB */
156−#define STACK_TOP_USER64 TASK_SIZE_128TB
157−#else
158−#define STACK_TOP_USER64 TASK_SIZE_USER64
159−#endif
160−
159+#define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64
161160 #define STACK_TOP_USER32 TASK_SIZE_USER32
162161
163162 #define STACK_TOP (is_32bit_task() ? \
arch/powerpc/include/asm/topology.h+14−0
@@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topology(void); · 43 unmodified lines
4444 extern int sysfs_add_device_to_node(struct device *dev, int nid);
4545 extern void sysfs_remove_device_from_node(struct device *dev, int nid);
4646
47+static inline int early_cpu_to_node(int cpu)
48+{
49+ int nid;
50+
51+ nid = numa_cpu_lookup_table[cpu];
52+
53+ /*
54+ * Fall back to node 0 if nid is unset (it should be, except bugs).
55+ * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)).
56+ */
57+ return (nid < 0) ? 0 : nid;
58+}
4759 #else
4860
61+static inline int early_cpu_to_node(int cpu) { return 0; }
62+
4963 static inline void dump_numa_cpu_topology(void) {}
5064
5165 static inline int sysfs_add_device_to_node(struct device *dev, int nid)
arch/powerpc/kernel/dt_cpu_ftrs.c+48−10
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/export.h>
99 #include <linux/init.h>
1010 #include <linux/jump_label.h>
11+#include <linux/libfdt.h>
1112 #include <linux/memblock.h>
1213 #include <linux/printk.h>
1314 #include <linux/sched.h>
@@ -642,7 +643,6 @@ static struct dt_cpu_feature_match __initdata · 628 unmodified lines
642643 {"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL},
643644 {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL},
644645 {"processor-utilization-of-resources-register", feat_enable_purr, 0},
645− {"subcore", feat_enable, CPU_FTR_SUBCORE},
646646 {"no-execute", feat_enable, 0},
647647 {"strong-access-ordering", feat_enable, CPU_FTR_SAO},
648648 {"cache-inhibited-large-page", feat_enable_large_ci, 0},
@@ -671,12 +671,24 @@ static struct dt_cpu_feature_match __initdata · 22 unmodified lines
671671 {"wait-v3", feat_enable, 0},
672672 };
673673
674−/* XXX: how to configure this? Default + boot time? */
675−#ifdef CONFIG_PPC_CPUFEATURES_ENABLE_UNKNOWN
676−#define CPU_FEATURE_ENABLE_UNKNOWN 1
677−#else
678−#define CPU_FEATURE_ENABLE_UNKNOWN 0
679−#endif
674+static bool __initdata using_dt_cpu_ftrs;
675+static bool __initdata enable_unknown = true;
676+
677+static int __init dt_cpu_ftrs_parse(char *str)
678+{
679+ if (!str)
680+ return 0;
681+
682+ if (!strcmp(str, "off"))
683+ using_dt_cpu_ftrs = false;
684+ else if (!strcmp(str, "known"))
685+ enable_unknown = false;
686+ else
687+ return 1;
688+
689+ return 0;
690+}
691+early_param("dt_cpu_ftrs", dt_cpu_ftrs_parse);
680692
681693 static void __init cpufeatures_setup_start(u32 isa)
682694 {
@@ -707,7 +719,7 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f) · 24 unmodified lines
707719 }
708720 }
709721
710− if (!known && CPU_FEATURE_ENABLE_UNKNOWN) {
722+ if (!known && enable_unknown) {
711723 if (!feat_try_enable_unknown(f)) {
712724 pr_info("not enabling: %s (unknown and unsupported by kernel)\n",
713725 f->name);
@@ -756,6 +768,26 @@ static void __init cpufeatures_setup_finished(void) · 42 unmodified lines
756768 cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features);
757769 }
758770
771+static int __init disabled_on_cmdline(void)
772+{
773+ unsigned long root, chosen;
774+ const char *p;
775+
776+ root = of_get_flat_dt_root();
777+ chosen = of_get_flat_dt_subnode_by_name(root, "chosen");
778+ if (chosen == -FDT_ERR_NOTFOUND)
779+ return false;
780+
781+ p = of_get_flat_dt_prop(chosen, "bootargs", NULL);
782+ if (!p)
783+ return false;
784+
785+ if (strstr(p, "dt_cpu_ftrs=off"))
786+ return true;
787+
788+ return false;
789+}
790+
759791 static int __init fdt_find_cpu_features(unsigned long node, const char *uname,
760792 int depth, void *data)
761793 {
@@ -766,8 +798,6 @@ static int __init fdt_find_cpu_features(unsigned long node, const char *uname, · 4 unmodified lines
766798 return 0;
767799 }
768800
769−static bool __initdata using_dt_cpu_ftrs = false;
770−
771801 bool __init dt_cpu_ftrs_in_use(void)
772802 {
773803 return using_dt_cpu_ftrs;
@@ -775,6 +805,8 @@ bool __init dt_cpu_ftrs_in_use(void) · 1 unmodified line
775805
776806 bool __init dt_cpu_ftrs_init(void *fdt)
777807 {
808+ using_dt_cpu_ftrs = false;
809+
778810 /* Setup and verify the FDT, if it fails we just bail */
779811 if (!early_init_dt_verify(fdt))
780812 return false;
@@ -782,6 +814,9 @@ bool __init dt_cpu_ftrs_init(void *fdt) · 1 unmodified line
782814 if (!of_scan_flat_dt(fdt_find_cpu_features, NULL))
783815 return false;
784816
817+ if (disabled_on_cmdline())
818+ return false;
819+
785820 cpufeatures_setup_cpu();
786821
787822 using_dt_cpu_ftrs = true;
@@ -1027,5 +1062,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char · 239 unmodified lines
10271062
10281063 void __init dt_cpu_ftrs_scan(void)
10291064 {
1065+ if (!using_dt_cpu_ftrs)
1066+ return;
1067+
10301068 of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL);
10311069 }
arch/powerpc/kernel/process.c+3−0
@@ -1666,6 +1666,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 1665 unmodified lines
16661666 #ifdef CONFIG_VSX
16671667 current->thread.used_vsr = 0;
16681668 #endif
1669+ current->thread.load_fp = 0;
16691670 memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state));
16701671 current->thread.fp_save_area = NULL;
16711672 #ifdef CONFIG_ALTIVEC
@@ -1674,6 +1675,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 2 unmodified lines
16741675 current->thread.vr_save_area = NULL;
16751676 current->thread.vrsave = 0;
16761677 current->thread.used_vr = 0;
1678+ current->thread.load_vec = 0;
16771679 #endif /* CONFIG_ALTIVEC */
16781680 #ifdef CONFIG_SPE
16791681 memset(current->thread.evr, 0, sizeof(current->thread.evr));
@@ -1685,6 +1687,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 5 unmodified lines
16851687 current->thread.tm_tfhar = 0;
16861688 current->thread.tm_texasr = 0;
16871689 current->thread.tm_tfiar = 0;
1690+ current->thread.load_tm = 0;
16881691 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
16891692 }
16901693 EXPORT_SYMBOL(start_thread);
arch/powerpc/kernel/setup-common.c+1−1
@@ -928,7 +928,7 @@ void __init setup_arch(char **cmdline_p) · 927 unmodified lines
928928
929929 #ifdef CONFIG_PPC_MM_SLICES
930930 #ifdef CONFIG_PPC64
931− init_mm.context.addr_limit = TASK_SIZE_128TB;
931+ init_mm.context.addr_limit = DEFAULT_MAP_WINDOW_USER64;
932932 #else
933933 #error "context.addr_limit not initialized."
934934 #endif
arch/powerpc/kernel/setup_64.c+2−2
@@ -661,7 +661,7 @@ void __init emergency_stack_init(void) · 660 unmodified lines
661661
662662 static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
663663 {
664− return __alloc_bootmem_node(NODE_DATA(cpu_to_node(cpu)), size, align,
664+ return __alloc_bootmem_node(NODE_DATA(early_cpu_to_node(cpu)), size, align,
665665 __pa(MAX_DMA_ADDRESS));
666666 }
667667
@@ -672,7 +672,7 @@ static void __init pcpu_fc_free(void *ptr, size_t size) · 4 unmodified lines
672672
673673 static int pcpu_cpu_distance(unsigned int from, unsigned int to)
674674 {
675− if (cpu_to_node(from) == cpu_to_node(to))
675+ if (early_cpu_to_node(from) == early_cpu_to_node(to))
676676 return LOCAL_DISTANCE;
677677 else
678678 return REMOTE_DISTANCE;
arch/powerpc/mm/mmu_context_book3s64.c+1−1
@@ -99,7 +99,7 @@ static int hash__init_new_context(struct mm_struct *mm) · 98 unmodified lines
9999 * mm->context.addr_limit. Default to max task size so that we copy the
100100 * default values to paca which will help us to handle slb miss early.
101101 */
102− mm->context.addr_limit = TASK_SIZE_128TB;
102+ mm->context.addr_limit = DEFAULT_MAP_WINDOW_USER64;
103103
104104 /*
105105 * The old code would re-promote on fork, we don't do that when using
arch/powerpc/perf/power9-pmu.c+2−2
@@ -402,7 +402,7 @@ static struct power_pmu power9_isa207_pmu = { · 401 unmodified lines
402402 .name = "POWER9",
403403 .n_counter = MAX_PMU_COUNTERS,
404404 .add_fields = ISA207_ADD_FIELDS,
405− .test_adder = ISA207_TEST_ADDER,
405+ .test_adder = P9_DD1_TEST_ADDER,
406406 .compute_mmcr = isa207_compute_mmcr,
407407 .config_bhrb = power9_config_bhrb,
408408 .bhrb_filter_map = power9_bhrb_filter_map,
@@ -421,7 +421,7 @@ static struct power_pmu power9_pmu = { · 12 unmodified lines
421421 .name = "POWER9",
422422 .n_counter = MAX_PMU_COUNTERS,
423423 .add_fields = ISA207_ADD_FIELDS,
424− .test_adder = P9_DD1_TEST_ADDER,
424+ .test_adder = ISA207_TEST_ADDER,
425425 .compute_mmcr = isa207_compute_mmcr,
426426 .config_bhrb = power9_config_bhrb,
427427 .bhrb_filter_map = power9_bhrb_filter_map,
arch/powerpc/platforms/Kconfig+11−0
@@ -59,6 +59,17 @@ config PPC_OF_BOOT_TRAMPOLINE · 58 unmodified lines
5959
6060 In case of doubt, say Y
6161
62+config PPC_DT_CPU_FTRS
63+ bool "Device-tree based CPU feature discovery & setup"
64+ depends on PPC_BOOK3S_64
65+ default y
66+ help
67+ This enables code to use a new device tree binding for describing CPU
68+ compatibility and features. Saying Y here will attempt to use the new
69+ binding if the firmware provides it. Currently only the skiboot
70+ firmware provides this binding.
71+ If you're not sure say Y.
72+
6273 config UDBG_RTAS_CONSOLE
6374 bool "RTAS based debug console"
6475 depends on PPC_RTAS
arch/powerpc/platforms/cell/spufs/coredump.c+2−0
@@ -175,6 +175,8 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i, · 174 unmodified lines
175175 skip = roundup(cprm->pos - total + sz, 4) - cprm->pos;
176176 if (!dump_skip(cprm, skip))
177177 goto Eio;
178+
179+ rc = 0;
178180 out:
179181 free_page((unsigned long)buf);
180182 return rc;
arch/powerpc/platforms/powernv/subcore.c+7−1
@@ -407,7 +407,13 @@ static DEVICE_ATTR(subcores_per_core, 0644, · 406 unmodified lines
407407
408408 static int subcore_init(void)
409409 {
410− if (!cpu_has_feature(CPU_FTR_SUBCORE))
410+ unsigned pvr_ver;
411+
412+ pvr_ver = PVR_VER(mfspr(SPRN_PVR));
413+
414+ if (pvr_ver != PVR_POWER8 &&
415+ pvr_ver != PVR_POWER8E &&
416+ pvr_ver != PVR_POWER8NVL)
411417 return 0;
412418
413419 /*
arch/powerpc/platforms/pseries/hotplug-memory.c+2−0
@@ -124,6 +124,7 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn) · 123 unmodified lines
124124 for (i = 0; i < num_lmbs; i++) {
125125 lmbs[i].base_addr = be64_to_cpu(lmbs[i].base_addr);
126126 lmbs[i].drc_index = be32_to_cpu(lmbs[i].drc_index);
127+ lmbs[i].aa_index = be32_to_cpu(lmbs[i].aa_index);
127128 lmbs[i].flags = be32_to_cpu(lmbs[i].flags);
128129 }
129130
@@ -147,6 +148,7 @@ static void dlpar_update_drconf_property(struct device_node *dn, · 17 unmodified lines
147148 for (i = 0; i < num_lmbs; i++) {
148149 lmbs[i].base_addr = cpu_to_be64(lmbs[i].base_addr);
149150 lmbs[i].drc_index = cpu_to_be32(lmbs[i].drc_index);
151+ lmbs[i].aa_index = cpu_to_be32(lmbs[i].aa_index);
150152 lmbs[i].flags = cpu_to_be32(lmbs[i].flags);
151153 }
152154
arch/powerpc/sysdev/simple_gpio.c+2−1
@@ -75,7 +75,8 @@ static int u8_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · 74 unmodified lines
7575
7676 static void u8_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)
7777 {
78− struct u8_gpio_chip *u8_gc = gpiochip_get_data(&mm_gc->gc);
78+ struct u8_gpio_chip *u8_gc =
79+ container_of(mm_gc, struct u8_gpio_chip, mm_gc);
7980
8081 u8_gc->data = in_8(mm_gc->regs);
8182 }
arch/s390/Kconfig+0−3
@@ -363,9 +363,6 @@ config COMPAT · 362 unmodified lines
363363 config SYSVIPC_COMPAT
364364 def_bool y if COMPAT && SYSVIPC
365365
366−config KEYS_COMPAT
367− def_bool y if COMPAT && KEYS
368−
369366 config SMP
370367 def_bool y
371368 prompt "Symmetric multi-processing support"
arch/s390/configs/default_defconfig+33−6
@@ -30,6 +30,7 @@ CONFIG_USER_NS=y · 29 unmodified lines
3030 CONFIG_SCHED_AUTOGROUP=y
3131 CONFIG_BLK_DEV_INITRD=y
3232 CONFIG_EXPERT=y
33+# CONFIG_SYSFS_SYSCALL is not set
3334 CONFIG_BPF_SYSCALL=y
3435 CONFIG_USERFAULTFD=y
3536 # CONFIG_COMPAT_BRK is not set
@@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 8 unmodified lines
4445 CONFIG_MODULE_FORCE_UNLOAD=y
4546 CONFIG_MODVERSIONS=y
4647 CONFIG_MODULE_SRCVERSION_ALL=y
48+CONFIG_BLK_DEV_INTEGRITY=y
4749 CONFIG_BLK_DEV_THROTTLING=y
50+CONFIG_BLK_WBT=y
51+CONFIG_BLK_WBT_SQ=y
4852 CONFIG_PARTITION_ADVANCED=y
4953 CONFIG_IBM_PARTITION=y
5054 CONFIG_BSD_DISKLABEL=y
@@ -90,6 +94,8 @@ CONFIG_UNIX=y · 39 unmodified lines
9094 CONFIG_UNIX_DIAG=m
9195 CONFIG_XFRM_USER=m
9296 CONFIG_NET_KEY=m
97+CONFIG_SMC=m
98+CONFIG_SMC_DIAG=m
9399 CONFIG_INET=y
94100 CONFIG_IP_MULTICAST=y
95101 CONFIG_IP_ADVANCED_ROUTER=y
@@ -359,6 +365,7 @@ CONFIG_NET_ACT_SIMP=m · 263 unmodified lines
359365 CONFIG_NET_ACT_SKBEDIT=m
360366 CONFIG_NET_ACT_CSUM=m
361367 CONFIG_DNS_RESOLVER=y
368+CONFIG_NETLINK_DIAG=m
362369 CONFIG_CGROUP_NET_PRIO=y
363370 CONFIG_BPF_JIT=y
364371 CONFIG_NET_PKTGEN=m
@@ -367,16 +374,19 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
367374 CONFIG_DMA_CMA=y
368375 CONFIG_CMA_SIZE_MBYTES=0
369376 CONFIG_CONNECTOR=y
377+CONFIG_ZRAM=m
370378 CONFIG_BLK_DEV_LOOP=m
371379 CONFIG_BLK_DEV_CRYPTOLOOP=m
380+CONFIG_BLK_DEV_DRBD=m
372381 CONFIG_BLK_DEV_NBD=m
373382 CONFIG_BLK_DEV_OSD=m
374383 CONFIG_BLK_DEV_RAM=y
375384 CONFIG_BLK_DEV_RAM_SIZE=32768
376−CONFIG_CDROM_PKTCDVD=m
377−CONFIG_ATA_OVER_ETH=m
385+CONFIG_BLK_DEV_RAM_DAX=y
378386 CONFIG_VIRTIO_BLK=y
387+CONFIG_BLK_DEV_RBD=m
379388 CONFIG_ENCLOSURE_SERVICES=m
389+CONFIG_GENWQE=m
380390 CONFIG_RAID_ATTRS=m
381391 CONFIG_SCSI=y
382392 CONFIG_BLK_DEV_SD=y
@@ -442,6 +452,8 @@ CONFIG_NLMON=m · 59 unmodified lines
442452 # CONFIG_NET_VENDOR_INTEL is not set
443453 # CONFIG_NET_VENDOR_MARVELL is not set
444454 CONFIG_MLX4_EN=m
455+CONFIG_MLX5_CORE=m
456+CONFIG_MLX5_CORE_EN=y
445457 # CONFIG_NET_VENDOR_NATSEMI is not set
446458 CONFIG_PPP=m
447459 CONFIG_PPP_BSDCOMP=m
@@ -452,7 +464,6 @@ CONFIG_PPTP=m · 4 unmodified lines
452464 CONFIG_PPPOL2TP=m
453465 CONFIG_PPP_ASYNC=m
454466 CONFIG_PPP_SYNC_TTY=m
455−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
456467 # CONFIG_INPUT_KEYBOARD is not set
457468 # CONFIG_INPUT_MOUSE is not set
458469 # CONFIG_SERIO is not set
@@ -471,6 +482,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
471482 CONFIG_INFINIBAND=m
472483 CONFIG_INFINIBAND_USER_ACCESS=m
473484 CONFIG_MLX4_INFINIBAND=m
485+CONFIG_MLX5_INFINIBAND=m
474486 CONFIG_VIRTIO_BALLOON=m
475487 CONFIG_EXT4_FS=y
476488 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -487,12 +499,18 @@ CONFIG_XFS_POSIX_ACL=y · 10 unmodified lines
487499 CONFIG_XFS_RT=y
488500 CONFIG_XFS_DEBUG=y
489501 CONFIG_GFS2_FS=m
502+CONFIG_GFS2_FS_LOCKING_DLM=y
490503 CONFIG_OCFS2_FS=m
491504 CONFIG_BTRFS_FS=y
492505 CONFIG_BTRFS_FS_POSIX_ACL=y
506+CONFIG_BTRFS_DEBUG=y
493507 CONFIG_NILFS2_FS=m
508+CONFIG_FS_DAX=y
509+CONFIG_EXPORTFS_BLOCK_OPS=y
494510 CONFIG_FANOTIFY=y
511+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
495512 CONFIG_QUOTA_NETLINK_INTERFACE=y
513+CONFIG_QUOTA_DEBUG=y
496514 CONFIG_QFMT_V1=m
497515 CONFIG_QFMT_V2=m
498516 CONFIG_AUTOFS4_FS=m
@@ -558,6 +576,7 @@ CONFIG_HEADERS_CHECK=y · 59 unmodified lines
558576 CONFIG_DEBUG_SECTION_MISMATCH=y
559577 CONFIG_MAGIC_SYSRQ=y
560578 CONFIG_DEBUG_PAGEALLOC=y
579+CONFIG_DEBUG_RODATA_TEST=y
561580 CONFIG_DEBUG_OBJECTS=y
562581 CONFIG_DEBUG_OBJECTS_SELFTEST=y
563582 CONFIG_DEBUG_OBJECTS_FREE=y
@@ -580,7 +599,6 @@ CONFIG_DETECT_HUNG_TASK=y · 16 unmodified lines
580599 CONFIG_WQ_WATCHDOG=y
581600 CONFIG_PANIC_ON_OOPS=y
582601 CONFIG_DEBUG_TIMEKEEPING=y
583−CONFIG_TIMER_STATS=y
584602 CONFIG_DEBUG_RT_MUTEXES=y
585603 CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
586604 CONFIG_PROVE_LOCKING=y
@@ -595,6 +613,7 @@ CONFIG_RCU_TORTURE_TEST=m · 8 unmodified lines
595613 CONFIG_RCU_CPU_STALL_TIMEOUT=300
596614 CONFIG_NOTIFIER_ERROR_INJECTION=m
597615 CONFIG_PM_NOTIFIER_ERROR_INJECT=m
616+CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
598617 CONFIG_FAULT_INJECTION=y
599618 CONFIG_FAILSLAB=y
600619 CONFIG_FAIL_PAGE_ALLOC=y
@@ -616,13 +635,12 @@ CONFIG_HIST_TRIGGERS=y · 15 unmodified lines
616635 CONFIG_TRACE_ENUM_MAP_FILE=y
617636 CONFIG_LKDTM=m
618637 CONFIG_TEST_LIST_SORT=y
638+CONFIG_TEST_SORT=y
619639 CONFIG_KPROBES_SANITY_TEST=y
620640 CONFIG_RBTREE_TEST=y
621641 CONFIG_INTERVAL_TREE_TEST=m
622642 CONFIG_PERCPU_TEST=m
623643 CONFIG_ATOMIC64_SELFTEST=y
624−CONFIG_TEST_STRING_HELPERS=y
625−CONFIG_TEST_KSTRTOX=y
626644 CONFIG_DMA_API_DEBUG=y
627645 CONFIG_TEST_BPF=m
628646 CONFIG_BUG_ON_DATA_CORRUPTION=y
@@ -630,6 +648,7 @@ CONFIG_S390_PTDUMP=y · 1 unmodified line
630648 CONFIG_ENCRYPTED_KEYS=m
631649 CONFIG_SECURITY=y
632650 CONFIG_SECURITY_NETWORK=y
651+CONFIG_HARDENED_USERCOPY=y
633652 CONFIG_SECURITY_SELINUX=y
634653 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
635654 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -640,7 +659,9 @@ CONFIG_CRYPTO_RSA=m · 4 unmodified lines
640659 CONFIG_CRYPTO_DH=m
641660 CONFIG_CRYPTO_ECDH=m
642661 CONFIG_CRYPTO_USER=m
662+CONFIG_CRYPTO_PCRYPT=m
643663 CONFIG_CRYPTO_CRYPTD=m
664+CONFIG_CRYPTO_MCRYPTD=m
644665 CONFIG_CRYPTO_TEST=m
645666 CONFIG_CRYPTO_CCM=m
646667 CONFIG_CRYPTO_GCM=m
@@ -648,6 +669,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 1 unmodified line
648669 CONFIG_CRYPTO_LRW=m
649670 CONFIG_CRYPTO_PCBC=m
650671 CONFIG_CRYPTO_KEYWRAP=m
672+CONFIG_CRYPTO_CMAC=m
651673 CONFIG_CRYPTO_XCBC=m
652674 CONFIG_CRYPTO_VMAC=m
653675 CONFIG_CRYPTO_CRC32=m
@@ -657,8 +679,10 @@ CONFIG_CRYPTO_RMD160=m · 3 unmodified lines
657679 CONFIG_CRYPTO_RMD256=m
658680 CONFIG_CRYPTO_RMD320=m
659681 CONFIG_CRYPTO_SHA512=m
682+CONFIG_CRYPTO_SHA3=m
660683 CONFIG_CRYPTO_TGR192=m
661684 CONFIG_CRYPTO_WP512=m
685+CONFIG_CRYPTO_AES_TI=m
662686 CONFIG_CRYPTO_ANUBIS=m
663687 CONFIG_CRYPTO_BLOWFISH=m
664688 CONFIG_CRYPTO_CAMELLIA=m
@@ -674,6 +698,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
674698 CONFIG_CRYPTO_842=m
675699 CONFIG_CRYPTO_LZ4=m
676700 CONFIG_CRYPTO_LZ4HC=m
701+CONFIG_CRYPTO_ANSI_CPRNG=m
677702 CONFIG_CRYPTO_USER_API_HASH=m
678703 CONFIG_CRYPTO_USER_API_SKCIPHER=m
679704 CONFIG_CRYPTO_USER_API_RNG=m
@@ -685,6 +710,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines
685710 CONFIG_CRYPTO_SHA512_S390=m
686711 CONFIG_CRYPTO_DES_S390=m
687712 CONFIG_CRYPTO_AES_S390=m
713+CONFIG_CRYPTO_PAES_S390=m
688714 CONFIG_CRYPTO_GHASH_S390=m
689715 CONFIG_CRYPTO_CRC32_S390=y
690716 CONFIG_ASYMMETRIC_KEY_TYPE=y
@@ -692,6 +718,7 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m · 1 unmodified line
692718 CONFIG_X509_CERTIFICATE_PARSER=m
693719 CONFIG_CRC7=m
694720 CONFIG_CRC8=m
721+CONFIG_RANDOM32_SELFTEST=y
695722 CONFIG_CORDIC=m
696723 CONFIG_CMM=m
697724 CONFIG_APPLDATA_BASE=y
arch/s390/configs/gcov_defconfig+24−4
@@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines
3131 CONFIG_SCHED_AUTOGROUP=y
3232 CONFIG_BLK_DEV_INITRD=y
3333 CONFIG_EXPERT=y
34+# CONFIG_SYSFS_SYSCALL is not set
3435 CONFIG_BPF_SYSCALL=y
3536 CONFIG_USERFAULTFD=y
3637 # CONFIG_COMPAT_BRK is not set
@@ -46,7 +47,10 @@ CONFIG_MODULE_UNLOAD=y · 9 unmodified lines
4647 CONFIG_MODULE_FORCE_UNLOAD=y
4748 CONFIG_MODVERSIONS=y
4849 CONFIG_MODULE_SRCVERSION_ALL=y
50+CONFIG_BLK_DEV_INTEGRITY=y
4951 CONFIG_BLK_DEV_THROTTLING=y
52+CONFIG_BLK_WBT=y
53+CONFIG_BLK_WBT_SQ=y
5054 CONFIG_PARTITION_ADVANCED=y
5155 CONFIG_IBM_PARTITION=y
5256 CONFIG_BSD_DISKLABEL=y
@@ -88,6 +92,8 @@ CONFIG_UNIX=y · 35 unmodified lines
8892 CONFIG_UNIX_DIAG=m
8993 CONFIG_XFRM_USER=m
9094 CONFIG_NET_KEY=m
95+CONFIG_SMC=m
96+CONFIG_SMC_DIAG=m
9197 CONFIG_INET=y
9298 CONFIG_IP_MULTICAST=y
9399 CONFIG_IP_ADVANCED_ROUTER=y
@@ -356,6 +362,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines
356362 CONFIG_NET_ACT_SKBEDIT=m
357363 CONFIG_NET_ACT_CSUM=m
358364 CONFIG_DNS_RESOLVER=y
365+CONFIG_NETLINK_DIAG=m
359366 CONFIG_CGROUP_NET_PRIO=y
360367 CONFIG_BPF_JIT=y
361368 CONFIG_NET_PKTGEN=m
@@ -364,16 +371,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
364371 CONFIG_DMA_CMA=y
365372 CONFIG_CMA_SIZE_MBYTES=0
366373 CONFIG_CONNECTOR=y
374+CONFIG_ZRAM=m
367375 CONFIG_BLK_DEV_LOOP=m
368376 CONFIG_BLK_DEV_CRYPTOLOOP=m
377+CONFIG_BLK_DEV_DRBD=m
369378 CONFIG_BLK_DEV_NBD=m
370379 CONFIG_BLK_DEV_OSD=m
371380 CONFIG_BLK_DEV_RAM=y
372381 CONFIG_BLK_DEV_RAM_SIZE=32768
373−CONFIG_CDROM_PKTCDVD=m
374−CONFIG_ATA_OVER_ETH=m
382+CONFIG_BLK_DEV_RAM_DAX=y
375383 CONFIG_VIRTIO_BLK=y
376384 CONFIG_ENCLOSURE_SERVICES=m
385+CONFIG_GENWQE=m
377386 CONFIG_RAID_ATTRS=m
378387 CONFIG_SCSI=y
379388 CONFIG_BLK_DEV_SD=y
@@ -439,6 +448,8 @@ CONFIG_NLMON=m · 59 unmodified lines
439448 # CONFIG_NET_VENDOR_INTEL is not set
440449 # CONFIG_NET_VENDOR_MARVELL is not set
441450 CONFIG_MLX4_EN=m
451+CONFIG_MLX5_CORE=m
452+CONFIG_MLX5_CORE_EN=y
442453 # CONFIG_NET_VENDOR_NATSEMI is not set
443454 CONFIG_PPP=m
444455 CONFIG_PPP_BSDCOMP=m
@@ -449,7 +460,6 @@ CONFIG_PPTP=m · 4 unmodified lines
449460 CONFIG_PPPOL2TP=m
450461 CONFIG_PPP_ASYNC=m
451462 CONFIG_PPP_SYNC_TTY=m
452−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
453463 # CONFIG_INPUT_KEYBOARD is not set
454464 # CONFIG_INPUT_MOUSE is not set
455465 # CONFIG_SERIO is not set
@@ -468,6 +478,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
468478 CONFIG_INFINIBAND=m
469479 CONFIG_INFINIBAND_USER_ACCESS=m
470480 CONFIG_MLX4_INFINIBAND=m
481+CONFIG_MLX5_INFINIBAND=m
471482 CONFIG_VIRTIO_BALLOON=m
472483 CONFIG_EXT4_FS=y
473484 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -483,11 +494,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines
483494 CONFIG_XFS_POSIX_ACL=y
484495 CONFIG_XFS_RT=y
485496 CONFIG_GFS2_FS=m
497+CONFIG_GFS2_FS_LOCKING_DLM=y
486498 CONFIG_OCFS2_FS=m
487499 CONFIG_BTRFS_FS=y
488500 CONFIG_BTRFS_FS_POSIX_ACL=y
489501 CONFIG_NILFS2_FS=m
502+CONFIG_FS_DAX=y
503+CONFIG_EXPORTFS_BLOCK_OPS=y
490504 CONFIG_FANOTIFY=y
505+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
491506 CONFIG_QUOTA_NETLINK_INTERFACE=y
492507 CONFIG_QFMT_V1=m
493508 CONFIG_QFMT_V2=m
@@ -553,7 +568,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines
553568 CONFIG_MAGIC_SYSRQ=y
554569 CONFIG_DEBUG_MEMORY_INIT=y
555570 CONFIG_PANIC_ON_OOPS=y
556−CONFIG_TIMER_STATS=y
557571 CONFIG_RCU_TORTURE_TEST=m
558572 CONFIG_RCU_CPU_STALL_TIMEOUT=60
559573 CONFIG_LATENCYTOP=y
@@ -576,6 +590,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines
576590 CONFIG_ENCRYPTED_KEYS=m
577591 CONFIG_SECURITY=y
578592 CONFIG_SECURITY_NETWORK=y
593+CONFIG_HARDENED_USERCOPY=y
579594 CONFIG_SECURITY_SELINUX=y
580595 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
581596 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -599,6 +614,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines
599614 CONFIG_CRYPTO_LRW=m
600615 CONFIG_CRYPTO_PCBC=m
601616 CONFIG_CRYPTO_KEYWRAP=m
617+CONFIG_CRYPTO_CMAC=m
602618 CONFIG_CRYPTO_XCBC=m
603619 CONFIG_CRYPTO_VMAC=m
604620 CONFIG_CRYPTO_CRC32=m
@@ -611,6 +627,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines
611627 CONFIG_CRYPTO_SHA3=m
612628 CONFIG_CRYPTO_TGR192=m
613629 CONFIG_CRYPTO_WP512=m
630+CONFIG_CRYPTO_AES_TI=m
614631 CONFIG_CRYPTO_ANUBIS=m
615632 CONFIG_CRYPTO_BLOWFISH=m
616633 CONFIG_CRYPTO_CAMELLIA=m
@@ -626,16 +643,19 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
626643 CONFIG_CRYPTO_842=m
627644 CONFIG_CRYPTO_LZ4=m
628645 CONFIG_CRYPTO_LZ4HC=m
646+CONFIG_CRYPTO_ANSI_CPRNG=m
629647 CONFIG_CRYPTO_USER_API_HASH=m
630648 CONFIG_CRYPTO_USER_API_SKCIPHER=m
631649 CONFIG_CRYPTO_USER_API_RNG=m
632650 CONFIG_CRYPTO_USER_API_AEAD=m
633651 CONFIG_ZCRYPT=m
652+CONFIG_PKEY=m
634653 CONFIG_CRYPTO_SHA1_S390=m
635654 CONFIG_CRYPTO_SHA256_S390=m
636655 CONFIG_CRYPTO_SHA512_S390=m
637656 CONFIG_CRYPTO_DES_S390=m
638657 CONFIG_CRYPTO_AES_S390=m
658+CONFIG_CRYPTO_PAES_S390=m
639659 CONFIG_CRYPTO_GHASH_S390=m
640660 CONFIG_CRYPTO_CRC32_S390=y
641661 CONFIG_CRC7=m
arch/s390/configs/performance_defconfig+23−4
@@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines
3131 CONFIG_SCHED_AUTOGROUP=y
3232 CONFIG_BLK_DEV_INITRD=y
3333 CONFIG_EXPERT=y
34+# CONFIG_SYSFS_SYSCALL is not set
3435 CONFIG_BPF_SYSCALL=y
3536 CONFIG_USERFAULTFD=y
3637 # CONFIG_COMPAT_BRK is not set
@@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 7 unmodified lines
4445 CONFIG_MODULE_FORCE_UNLOAD=y
4546 CONFIG_MODVERSIONS=y
4647 CONFIG_MODULE_SRCVERSION_ALL=y
48+CONFIG_BLK_DEV_INTEGRITY=y
4749 CONFIG_BLK_DEV_THROTTLING=y
50+CONFIG_BLK_WBT=y
51+CONFIG_BLK_WBT_SQ=y
4852 CONFIG_PARTITION_ADVANCED=y
4953 CONFIG_IBM_PARTITION=y
5054 CONFIG_BSD_DISKLABEL=y
@@ -86,6 +90,8 @@ CONFIG_UNIX=y · 35 unmodified lines
8690 CONFIG_UNIX_DIAG=m
8791 CONFIG_XFRM_USER=m
8892 CONFIG_NET_KEY=m
93+CONFIG_SMC=m
94+CONFIG_SMC_DIAG=m
8995 CONFIG_INET=y
9096 CONFIG_IP_MULTICAST=y
9197 CONFIG_IP_ADVANCED_ROUTER=y
@@ -354,6 +360,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines
354360 CONFIG_NET_ACT_SKBEDIT=m
355361 CONFIG_NET_ACT_CSUM=m
356362 CONFIG_DNS_RESOLVER=y
363+CONFIG_NETLINK_DIAG=m
357364 CONFIG_CGROUP_NET_PRIO=y
358365 CONFIG_BPF_JIT=y
359366 CONFIG_NET_PKTGEN=m
@@ -362,16 +369,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
362369 CONFIG_DMA_CMA=y
363370 CONFIG_CMA_SIZE_MBYTES=0
364371 CONFIG_CONNECTOR=y
372+CONFIG_ZRAM=m
365373 CONFIG_BLK_DEV_LOOP=m
366374 CONFIG_BLK_DEV_CRYPTOLOOP=m
375+CONFIG_BLK_DEV_DRBD=m
367376 CONFIG_BLK_DEV_NBD=m
368377 CONFIG_BLK_DEV_OSD=m
369378 CONFIG_BLK_DEV_RAM=y
370379 CONFIG_BLK_DEV_RAM_SIZE=32768
371−CONFIG_CDROM_PKTCDVD=m
372−CONFIG_ATA_OVER_ETH=m
380+CONFIG_BLK_DEV_RAM_DAX=y
373381 CONFIG_VIRTIO_BLK=y
374382 CONFIG_ENCLOSURE_SERVICES=m
383+CONFIG_GENWQE=m
375384 CONFIG_RAID_ATTRS=m
376385 CONFIG_SCSI=y
377386 CONFIG_BLK_DEV_SD=y
@@ -437,6 +446,8 @@ CONFIG_NLMON=m · 59 unmodified lines
437446 # CONFIG_NET_VENDOR_INTEL is not set
438447 # CONFIG_NET_VENDOR_MARVELL is not set
439448 CONFIG_MLX4_EN=m
449+CONFIG_MLX5_CORE=m
450+CONFIG_MLX5_CORE_EN=y
440451 # CONFIG_NET_VENDOR_NATSEMI is not set
441452 CONFIG_PPP=m
442453 CONFIG_PPP_BSDCOMP=m
@@ -447,7 +458,6 @@ CONFIG_PPTP=m · 4 unmodified lines
447458 CONFIG_PPPOL2TP=m
448459 CONFIG_PPP_ASYNC=m
449460 CONFIG_PPP_SYNC_TTY=m
450−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
451461 # CONFIG_INPUT_KEYBOARD is not set
452462 # CONFIG_INPUT_MOUSE is not set
453463 # CONFIG_SERIO is not set
@@ -466,6 +476,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
466476 CONFIG_INFINIBAND=m
467477 CONFIG_INFINIBAND_USER_ACCESS=m
468478 CONFIG_MLX4_INFINIBAND=m
479+CONFIG_MLX5_INFINIBAND=m
469480 CONFIG_VIRTIO_BALLOON=m
470481 CONFIG_EXT4_FS=y
471482 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -481,11 +492,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines
481492 CONFIG_XFS_POSIX_ACL=y
482493 CONFIG_XFS_RT=y
483494 CONFIG_GFS2_FS=m
495+CONFIG_GFS2_FS_LOCKING_DLM=y
484496 CONFIG_OCFS2_FS=m
485497 CONFIG_BTRFS_FS=y
486498 CONFIG_BTRFS_FS_POSIX_ACL=y
487499 CONFIG_NILFS2_FS=m
500+CONFIG_FS_DAX=y
501+CONFIG_EXPORTFS_BLOCK_OPS=y
488502 CONFIG_FANOTIFY=y
503+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
489504 CONFIG_QUOTA_NETLINK_INTERFACE=y
490505 CONFIG_QFMT_V1=m
491506 CONFIG_QFMT_V2=m
@@ -551,7 +566,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines
551566 CONFIG_MAGIC_SYSRQ=y
552567 CONFIG_DEBUG_MEMORY_INIT=y
553568 CONFIG_PANIC_ON_OOPS=y
554−CONFIG_TIMER_STATS=y
555569 CONFIG_RCU_TORTURE_TEST=m
556570 CONFIG_RCU_CPU_STALL_TIMEOUT=60
557571 CONFIG_LATENCYTOP=y
@@ -574,6 +588,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines
574588 CONFIG_ENCRYPTED_KEYS=m
575589 CONFIG_SECURITY=y
576590 CONFIG_SECURITY_NETWORK=y
591+CONFIG_HARDENED_USERCOPY=y
577592 CONFIG_SECURITY_SELINUX=y
578593 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
579594 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -597,6 +612,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines
597612 CONFIG_CRYPTO_LRW=m
598613 CONFIG_CRYPTO_PCBC=m
599614 CONFIG_CRYPTO_KEYWRAP=m
615+CONFIG_CRYPTO_CMAC=m
600616 CONFIG_CRYPTO_XCBC=m
601617 CONFIG_CRYPTO_VMAC=m
602618 CONFIG_CRYPTO_CRC32=m
@@ -609,6 +625,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines
609625 CONFIG_CRYPTO_SHA3=m
610626 CONFIG_CRYPTO_TGR192=m
611627 CONFIG_CRYPTO_WP512=m
628+CONFIG_CRYPTO_AES_TI=m
612629 CONFIG_CRYPTO_ANUBIS=m
613630 CONFIG_CRYPTO_BLOWFISH=m
614631 CONFIG_CRYPTO_CAMELLIA=m
@@ -624,6 +641,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
624641 CONFIG_CRYPTO_842=m
625642 CONFIG_CRYPTO_LZ4=m
626643 CONFIG_CRYPTO_LZ4HC=m
644+CONFIG_CRYPTO_ANSI_CPRNG=m
627645 CONFIG_CRYPTO_USER_API_HASH=m
628646 CONFIG_CRYPTO_USER_API_SKCIPHER=m
629647 CONFIG_CRYPTO_USER_API_RNG=m
@@ -635,6 +653,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines
635653 CONFIG_CRYPTO_SHA512_S390=m
636654 CONFIG_CRYPTO_DES_S390=m
637655 CONFIG_CRYPTO_AES_S390=m
656+CONFIG_CRYPTO_PAES_S390=m
638657 CONFIG_CRYPTO_GHASH_S390=m
639658 CONFIG_CRYPTO_CRC32_S390=y
640659 CONFIG_CRC7=m
arch/s390/configs/zfcpdump_defconfig+4−2
@@ -12,8 +12,10 @@ CONFIG_TUNE_ZEC12=y · 11 unmodified lines
1212 CONFIG_NR_CPUS=2
1313 # CONFIG_HOTPLUG_CPU is not set
1414 CONFIG_HZ_100=y
15+# CONFIG_ARCH_RANDOM is not set
1516 # CONFIG_COMPACTION is not set
1617 # CONFIG_MIGRATION is not set
18+# CONFIG_BOUNCE is not set
1719 # CONFIG_CHECK_STACK is not set
1820 # CONFIG_CHSC_SCH is not set
1921 # CONFIG_SCM_BUS is not set
@@ -36,11 +38,11 @@ CONFIG_SCSI_CONSTANTS=y · 16 unmodified lines
3638 CONFIG_SCSI_LOGGING=y
3739 CONFIG_SCSI_FC_ATTRS=y
3840 CONFIG_ZFCP=y
39−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
4041 # CONFIG_INPUT_KEYBOARD is not set
4142 # CONFIG_INPUT_MOUSE is not set
4243 # CONFIG_SERIO is not set
4344 # CONFIG_HVC_IUCV is not set
45+# CONFIG_HW_RANDOM_S390 is not set
4446 CONFIG_RAW_DRIVER=y
4547 # CONFIG_SCLP_ASYNC is not set
4648 # CONFIG_HMC_DRV is not set
@@ -54,9 +56,9 @@ CONFIG_RAW_DRIVER=y · 7 unmodified lines
5456 # CONFIG_INOTIFY_USER is not set
5557 CONFIG_CONFIGFS_FS=y
5658 # CONFIG_MISC_FILESYSTEMS is not set
59+# CONFIG_NETWORK_FILESYSTEMS is not set
5760 CONFIG_PRINTK_TIME=y
5861 CONFIG_DEBUG_INFO=y
59−CONFIG_DEBUG_FS=y
6062 CONFIG_DEBUG_KERNEL=y
6163 CONFIG_PANIC_ON_OOPS=y
6264 # CONFIG_SCHED_DEBUG is not set
arch/s390/defconfig+3−5
@@ -28,6 +28,7 @@ CONFIG_NAMESPACES=y · 27 unmodified lines
2828 CONFIG_USER_NS=y
2929 CONFIG_BLK_DEV_INITRD=y
3030 CONFIG_EXPERT=y
31+# CONFIG_SYSFS_SYSCALL is not set
3132 CONFIG_BPF_SYSCALL=y
3233 CONFIG_USERFAULTFD=y
3334 # CONFIG_COMPAT_BRK is not set
@@ -108,7 +109,6 @@ CONFIG_ZFCP=y · 74 unmodified lines
108109 CONFIG_SCSI_VIRTIO=y
109110 CONFIG_MD=y
110111 CONFIG_MD_LINEAR=m
111−CONFIG_MD_RAID0=m
112112 CONFIG_MD_MULTIPATH=m
113113 CONFIG_BLK_DEV_DM=y
114114 CONFIG_DM_CRYPT=m
@@ -131,6 +131,7 @@ CONFIG_TUN=m · 16 unmodified lines
131131 CONFIG_VIRTIO_NET=y
132132 # CONFIG_NET_VENDOR_ALACRITECH is not set
133133 # CONFIG_NET_VENDOR_SOLARFLARE is not set
134+# CONFIG_NET_VENDOR_SYNOPSYS is not set
134135 # CONFIG_INPUT is not set
135136 # CONFIG_SERIO is not set
136137 CONFIG_DEVKMEM=y
@@ -162,7 +163,6 @@ CONFIG_MAGIC_SYSRQ=y · 25 unmodified lines
162163 CONFIG_DEBUG_PAGEALLOC=y
163164 CONFIG_DETECT_HUNG_TASK=y
164165 CONFIG_PANIC_ON_OOPS=y
165−CONFIG_TIMER_STATS=y
166166 CONFIG_DEBUG_RT_MUTEXES=y
167167 CONFIG_PROVE_LOCKING=y
168168 CONFIG_LOCK_STAT=y
@@ -172,14 +172,12 @@ CONFIG_DEBUG_LIST=y · 3 unmodified lines
172172 CONFIG_DEBUG_SG=y
173173 CONFIG_DEBUG_NOTIFIERS=y
174174 CONFIG_RCU_CPU_STALL_TIMEOUT=60
175−CONFIG_RCU_TRACE=y
176175 CONFIG_LATENCYTOP=y
177176 CONFIG_SCHED_TRACER=y
178177 CONFIG_FTRACE_SYSCALLS=y
179178 CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y
180179 CONFIG_STACK_TRACER=y
181180 CONFIG_BLK_DEV_IO_TRACE=y
182−CONFIG_UPROBE_EVENTS=y
183181 CONFIG_FUNCTION_PROFILER=y
184182 CONFIG_TRACE_ENUM_MAP_FILE=y
185183 CONFIG_KPROBES_SANITY_TEST=y
@@ -190,7 +188,6 @@ CONFIG_CRYPTO_CCM=m · 4 unmodified lines
190188 CONFIG_CRYPTO_GCM=m
191189 CONFIG_CRYPTO_CBC=y
192190 CONFIG_CRYPTO_CTS=m
193−CONFIG_CRYPTO_ECB=m
194191 CONFIG_CRYPTO_LRW=m
195192 CONFIG_CRYPTO_PCBC=m
196193 CONFIG_CRYPTO_XTS=m
@@ -230,6 +227,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 33 unmodified lines
230227 CONFIG_CRYPTO_USER_API_RNG=m
231228 CONFIG_ZCRYPT=m
232229 CONFIG_PKEY=m
230+CONFIG_CRYPTO_PAES_S390=m
233231 CONFIG_CRYPTO_SHA1_S390=m
234232 CONFIG_CRYPTO_SHA256_S390=m
235233 CONFIG_CRYPTO_SHA512_S390=m
arch/s390/include/asm/kvm_host.h+0−1
@@ -541,7 +541,6 @@ struct kvm_s390_float_interrupt { · 540 unmodified lines
541541 struct mutex ais_lock;
542542 u8 simm;
543543 u8 nimm;
544− int ais_enabled;
545544 };
546545
547546 struct kvm_hw_wp_info_arch {
arch/s390/kernel/entry.S+13−6
@@ -231,12 +231,17 @@ ENTRY(sie64a) · 230 unmodified lines
231231 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
232232 .Lsie_done:
233233 # some program checks are suppressing. C code (e.g. do_protection_exception)
234−# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
235−# instructions between sie64a and .Lsie_done should not cause program
236−# interrupts. So lets use a nop (47 00 00 00) as a landing pad.
234+# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There
235+# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable.
236+# Other instructions between sie64a and .Lsie_done should not cause program
237+# interrupts. So lets use 3 nops as a landing pad for all possible rewinds.
237238 # See also .Lcleanup_sie
238−.Lrewind_pad:
239− nop 0
239+.Lrewind_pad6:
240+ nopr 7
241+.Lrewind_pad4:
242+ nopr 7
243+.Lrewind_pad2:
244+ nopr 7
240245 .globl sie_exit
241246 sie_exit:
242247 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
@@ -249,7 +254,9 @@ sie_exit: · 6 unmodified lines
249254 stg %r14,__SF_EMPTY+16(%r15) # set exit reason code
250255 j sie_exit
251256
252− EX_TABLE(.Lrewind_pad,.Lsie_fault)
257+ EX_TABLE(.Lrewind_pad6,.Lsie_fault)
258+ EX_TABLE(.Lrewind_pad4,.Lsie_fault)
259+ EX_TABLE(.Lrewind_pad2,.Lsie_fault)
253260 EX_TABLE(sie_exit,.Lsie_fault)
254261 EXPORT_SYMBOL(sie64a)
255262 EXPORT_SYMBOL(sie_exit)
arch/s390/kvm/interrupt.c+2−2
@@ -2160,7 +2160,7 @@ static int modify_ais_mode(struct kvm *kvm, struct kvm_device_attr *attr) · 2159 unmodified lines
21602160 struct kvm_s390_ais_req req;
21612161 int ret = 0;
21622162
2163− if (!fi->ais_enabled)
2163+ if (!test_kvm_facility(kvm, 72))
21642164 return -ENOTSUPP;
21652165
21662166 if (copy_from_user(&req, (void __user *)attr->addr, sizeof(req)))
@@ -2204,7 +2204,7 @@ static int kvm_s390_inject_airq(struct kvm *kvm, · 37 unmodified lines
22042204 };
22052205 int ret = 0;
22062206
2207− if (!fi->ais_enabled || !adapter->suppressible)
2207+ if (!test_kvm_facility(kvm, 72) || !adapter->suppressible)
22082208 return kvm_s390_inject_vm(kvm, &s390int);
22092209
22102210 mutex_lock(&fi->ais_lock);
arch/s390/kvm/kvm-s390.c+0−2
@@ -558,7 +558,6 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) · 557 unmodified lines
558558 } else {
559559 set_kvm_facility(kvm->arch.model.fac_mask, 72);
560560 set_kvm_facility(kvm->arch.model.fac_list, 72);
561− kvm->arch.float_int.ais_enabled = 1;
562561 r = 0;
563562 }
564563 mutex_unlock(&kvm->lock);
@@ -1533,7 +1532,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 968 unmodified lines
15331532 mutex_init(&kvm->arch.float_int.ais_lock);
15341533 kvm->arch.float_int.simm = 0;
15351534 kvm->arch.float_int.nimm = 0;
1536− kvm->arch.float_int.ais_enabled = 0;
15371535 spin_lock_init(&kvm->arch.float_int.lock);
15381536 for (i = 0; i < FIRQ_LIST_COUNT; i++)
15391537 INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]);
arch/sparc/Kconfig+0−3
@@ -577,9 +577,6 @@ config SYSVIPC_COMPAT · 576 unmodified lines
577577 depends on COMPAT && SYSVIPC
578578 default y
579579
580−config KEYS_COMPAT
581− def_bool y if COMPAT && KEYS
582−
583580 endmenu
584581
585582 source "net/Kconfig"
arch/x86/Kconfig+0−4
@@ -2776,10 +2776,6 @@ config COMPAT_FOR_U64_ALIGNMENT · 2775 unmodified lines
27762776 config SYSVIPC_COMPAT
27772777 def_bool y
27782778 depends on SYSVIPC
2779−
2780−config KEYS_COMPAT
2781− def_bool y
2782− depends on KEYS
27832779 endif
27842780
27852781 endmenu
arch/x86/kernel/cpu/cyrix.c+1−0
@@ -255,6 +255,7 @@ static void init_cyrix(struct cpuinfo_x86 *c) · 254 unmodified lines
255255 break;
256256
257257 case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */
258+ case 11: /* GX1 with inverted Device ID */
258259 #ifdef CONFIG_PCI
259260 {
260261 u32 vendor, device;
arch/x86/kernel/cpu/microcode/intel.c+3−0
@@ -619,6 +619,9 @@ int __init save_microcode_in_initrd_intel(void) · 618 unmodified lines
619619
620620 show_saved_mc();
621621
622+ /* initrd is going away, clear patch ptr. */
623+ intel_ucode_patch = NULL;
624+
622625 return 0;
623626 }
624627
arch/x86/kernel/kvm.c+1−1
@@ -161,8 +161,8 @@ void kvm_async_pf_task_wait(u32 token) · 160 unmodified lines
161161 */
162162 rcu_irq_exit();
163163 native_safe_halt();
164− rcu_irq_enter();
165164 local_irq_disable();
165+ rcu_irq_enter();
166166 }
167167 }
168168 if (!n.halted)
arch/x86/kvm/cpuid.c+11−9
@@ -780,18 +780,20 @@ out: · 779 unmodified lines
780780 static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
781781 {
782782 struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i];
783− int j, nent = vcpu->arch.cpuid_nent;
783+ struct kvm_cpuid_entry2 *ej;
784+ int j = i;
785+ int nent = vcpu->arch.cpuid_nent;
784786
785787 e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT;
786788 /* when no next entry is found, the current entry[i] is reselected */
787− for (j = i + 1; ; j = (j + 1) % nent) {
788− struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j];
789− if (ej->function == e->function) {
790− ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
791− return j;
792− }
793− }
794− return 0; /* silence gcc, even though control never reaches here */
789+ do {
790+ j = (j + 1) % nent;
791+ ej = &vcpu->arch.cpuid_entries[j];
792+ } while (ej->function != e->function);
793+
794+ ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
795+
796+ return j;
795797 }
796798
797799 /* find an entry with matching function, matching index (if needed), and that
arch/x86/kvm/mmu.c+5−2
@@ -3698,12 +3698,15 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn) · 3697 unmodified lines
36983698 return kvm_setup_async_pf(vcpu, gva, kvm_vcpu_gfn_to_hva(vcpu, gfn), &arch);
36993699 }
37003700
3701−static bool can_do_async_pf(struct kvm_vcpu *vcpu)
3701+bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu)
37023702 {
37033703 if (unlikely(!lapic_in_kernel(vcpu) ||
37043704 kvm_event_needs_reinjection(vcpu)))
37053705 return false;
37063706
3707+ if (is_guest_mode(vcpu))
3708+ return false;
3709+
37073710 return kvm_x86_ops->interrupt_allowed(vcpu);
37083711 }
37093712
@@ -3719,7 +3722,7 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, · 9 unmodified lines
37193722 if (!async)
37203723 return false; /* *pfn has correct page already */
37213724
3722− if (!prefault && can_do_async_pf(vcpu)) {
3725+ if (!prefault && kvm_can_do_async_pf(vcpu)) {
37233726 trace_kvm_try_async_get_page(gva, gfn);
37243727 if (kvm_find_async_pf_gfn(vcpu, gfn)) {
37253728 trace_kvm_async_pf_doublefault(gva, gfn);
arch/x86/kvm/mmu.h+1−0
@@ -76,6 +76,7 @@ int handle_mmio_page_fault(struct kvm_vcpu *vcpu, u64 addr, bool direct); · 75 unmodified lines
7676 void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu);
7777 void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly,
7878 bool accessed_dirty);
79+bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu);
7980
8081 static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm)
8182 {
arch/x86/kvm/vmx.c+1−1
@@ -2425,7 +2425,7 @@ static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr) · 2424 unmodified lines
24252425 if (!(vmcs12->exception_bitmap & (1u << nr)))
24262426 return 0;
24272427
2428− nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
2428+ nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI,
24292429 vmcs_read32(VM_EXIT_INTR_INFO),
24302430 vmcs_readl(EXIT_QUALIFICATION));
24312431 return 1;
arch/x86/kvm/x86.c+1−2
@@ -8607,8 +8607,7 @@ bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) · 8606 unmodified lines
86078607 if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED))
86088608 return true;
86098609 else
8610− return !kvm_event_needs_reinjection(vcpu) &&
8611− kvm_x86_ops->interrupt_allowed(vcpu);
8610+ return kvm_can_do_async_pf(vcpu);
86128611 }
86138612
86148613 void kvm_arch_start_assignment(struct kvm *kvm)
arch/xtensa/include/asm/irq.h+2−1
@@ -29,7 +29,8 @@ static inline void variant_irq_disable(unsigned int irq) { } · 28 unmodified lines
2929 # define PLATFORM_NR_IRQS 0
3030 #endif
3131 #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS
32−#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS)
32+#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS + 1)
33+#define XTENSA_PIC_LINUX_IRQ(hwirq) ((hwirq) + 1)
3334
3435 #if VARIANT_NR_IRQS == 0
3536 static inline void variant_init_irq(void) { }
arch/xtensa/kernel/irq.c+0−5
@@ -34,11 +34,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) · 33 unmodified lines
3434 {
3535 int irq = irq_find_mapping(NULL, hwirq);
3636
37− if (hwirq >= NR_IRQS) {
38− printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
39− __func__, hwirq);
40− }
41−
4237 #ifdef CONFIG_DEBUG_STACKOVERFLOW
4338 /* Debugging check for stack overflow: is there less than 1KB free? */
4439 {
arch/xtensa/kernel/setup.c+1−2
@@ -593,8 +593,7 @@ c_show(struct seq_file *f, void *slot) · 592 unmodified lines
593593 (ccount_freq/10000) % 100,
594594 loops_per_jiffy/(500000/HZ),
595595 (loops_per_jiffy/(5000/HZ)) % 100);
596−
597− seq_printf(f,"flags\t\t: "
596+ seq_puts(f, "flags\t\t: "
598597 #if XCHAL_HAVE_NMI
599598 "nmi "
600599 #endif
arch/xtensa/kernel/vmlinux.lds.S+3−3
@@ -118,7 +118,7 @@ SECTIONS · 117 unmodified lines
118118 SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
119119 SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
120120 SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
121− SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48)
121+ SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20)
122122 SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
123123 #endif
124124
@@ -306,13 +306,13 @@ SECTIONS · 181 unmodified lines
306306 .UserExceptionVector.literal)
307307 SECTION_VECTOR (_DoubleExceptionVector_literal,
308308 .DoubleExceptionVector.literal,
309− DOUBLEEXC_VECTOR_VADDR - 48,
309+ DOUBLEEXC_VECTOR_VADDR - 20,
310310 SIZEOF(.UserExceptionVector.text),
311311 .UserExceptionVector.text)
312312 SECTION_VECTOR (_DoubleExceptionVector_text,
313313 .DoubleExceptionVector.text,
314314 DOUBLEEXC_VECTOR_VADDR,
315− 48,
315+ 20,
316316 .DoubleExceptionVector.literal)
317317
318318 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
arch/xtensa/platforms/iss/simdisk.c+1−2
@@ -317,8 +317,7 @@ static int __init simdisk_init(void) · 316 unmodified lines
317317 if (simdisk_count > MAX_SIMDISK_COUNT)
318318 simdisk_count = MAX_SIMDISK_COUNT;
319319
320− sddev = kmalloc(simdisk_count * sizeof(struct simdisk),
321− GFP_KERNEL);
320+ sddev = kmalloc_array(simdisk_count, sizeof(*sddev), GFP_KERNEL);
322321 if (sddev == NULL)
323322 goto out_unregister;
324323
arch/xtensa/platforms/xtfpga/include/platform/hardware.h+4−2
@@ -24,16 +24,18 @@ · 23 unmodified lines
2424
2525 /* Interrupt configuration. */
2626
27−#define PLATFORM_NR_IRQS 10
27+#define PLATFORM_NR_IRQS 0
2828
2929 /* Default assignment of LX60 devices to external interrupts. */
3030
3131 #ifdef CONFIG_XTENSA_MX
3232 #define DUART16552_INTNUM XCHAL_EXTINT3_NUM
3333 #define OETH_IRQ XCHAL_EXTINT4_NUM
34+#define C67X00_IRQ XCHAL_EXTINT8_NUM
3435 #else
3536 #define DUART16552_INTNUM XCHAL_EXTINT0_NUM
3637 #define OETH_IRQ XCHAL_EXTINT1_NUM
38+#define C67X00_IRQ XCHAL_EXTINT5_NUM
3739 #endif
3840
3941 /*
@@ -63,5 +65,5 @@ · 23 unmodified lines
6365
6466 #define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000)
6567 #define C67X00_SIZE 0x10
66−#define C67X00_IRQ 5
68+
6769 #endif /* __XTENSA_XTAVNET_HARDWARE_H */
arch/xtensa/platforms/xtfpga/setup.c+5−5
@@ -175,8 +175,8 @@ static struct resource ethoc_res[] = { · 174 unmodified lines
175175 .flags = IORESOURCE_MEM,
176176 },
177177 [2] = { /* IRQ number */
178− .start = OETH_IRQ,
179− .end = OETH_IRQ,
178+ .start = XTENSA_PIC_LINUX_IRQ(OETH_IRQ),
179+ .end = XTENSA_PIC_LINUX_IRQ(OETH_IRQ),
180180 .flags = IORESOURCE_IRQ,
181181 },
182182 };
@@ -213,8 +213,8 @@ static struct resource c67x00_res[] = { · 30 unmodified lines
213213 .flags = IORESOURCE_MEM,
214214 },
215215 [1] = { /* IRQ number */
216− .start = C67X00_IRQ,
217− .end = C67X00_IRQ,
216+ .start = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ),
217+ .end = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ),
218218 .flags = IORESOURCE_IRQ,
219219 },
220220 };
@@ -247,7 +247,7 @@ static struct resource serial_resource = { · 26 unmodified lines
247247 static struct plat_serial8250_port serial_platform_data[] = {
248248 [0] = {
249249 .mapbase = DUART16552_PADDR,
250− .irq = DUART16552_INTNUM,
250+ .irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM),
251251 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
252252 UPF_IOREMAP,
253253 .iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32,
block/bfq-cgroup.c+93−23
@@ -52,7 +52,7 @@ BFQG_FLAG_FNS(idling) · 51 unmodified lines
5252 BFQG_FLAG_FNS(empty)
5353 #undef BFQG_FLAG_FNS
5454
55−/* This should be called with the queue_lock held. */
55+/* This should be called with the scheduler lock held. */
5656 static void bfqg_stats_update_group_wait_time(struct bfqg_stats *stats)
5757 {
5858 unsigned long long now;
@@ -67,7 +67,7 @@ static void bfqg_stats_update_group_wait_time(struct bfqg_stats *stats) · 8 unmodified lines
6767 bfqg_stats_clear_waiting(stats);
6868 }
6969
70−/* This should be called with the queue_lock held. */
70+/* This should be called with the scheduler lock held. */
7171 static void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg,
7272 struct bfq_group *curr_bfqg)
7373 {
@@ -81,7 +81,7 @@ static void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg, · 7 unmodified lines
8181 bfqg_stats_mark_waiting(stats);
8282 }
8383
84−/* This should be called with the queue_lock held. */
84+/* This should be called with the scheduler lock held. */
8585 static void bfqg_stats_end_empty_time(struct bfqg_stats *stats)
8686 {
8787 unsigned long long now;
@@ -203,12 +203,30 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq) · 115 unmodified lines
203203
204204 static void bfqg_get(struct bfq_group *bfqg)
205205 {
206− return blkg_get(bfqg_to_blkg(bfqg));
206+ bfqg->ref++;
207207 }
208208
209209 void bfqg_put(struct bfq_group *bfqg)
210210 {
211− return blkg_put(bfqg_to_blkg(bfqg));
211+ bfqg->ref--;
212+
213+ if (bfqg->ref == 0)
214+ kfree(bfqg);
215+}
216+
217+static void bfqg_and_blkg_get(struct bfq_group *bfqg)
218+{
219+ /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */
220+ bfqg_get(bfqg);
221+
222+ blkg_get(bfqg_to_blkg(bfqg));
223+}
224+
225+void bfqg_and_blkg_put(struct bfq_group *bfqg)
226+{
227+ bfqg_put(bfqg);
228+
229+ blkg_put(bfqg_to_blkg(bfqg));
212230 }
213231
214232 void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq,
@@ -312,7 +330,11 @@ void bfq_init_entity(struct bfq_entity *entity, struct bfq_group *bfqg) · 97 unmodified lines
312330 if (bfqq) {
313331 bfqq->ioprio = bfqq->new_ioprio;
314332 bfqq->ioprio_class = bfqq->new_ioprio_class;
315− bfqg_get(bfqg);
333+ /*
334+ * Make sure that bfqg and its associated blkg do not
335+ * disappear before entity.
336+ */
337+ bfqg_and_blkg_get(bfqg);
316338 }
317339 entity->parent = bfqg->my_entity; /* NULL for root group */
318340 entity->sched_data = &bfqg->sched_data;
@@ -399,6 +421,8 @@ struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, int node) · 80 unmodified lines
399421 return NULL;
400422 }
401423
424+ /* see comments in bfq_bic_update_cgroup for why refcounting */
425+ bfqg_get(bfqg);
402426 return &bfqg->pd;
403427 }
404428
@@ -426,7 +450,7 @@ void bfq_pd_free(struct blkg_policy_data *pd) · 21 unmodified lines
426450 struct bfq_group *bfqg = pd_to_bfqg(pd);
427451
428452 bfqg_stats_exit(&bfqg->stats);
429− return kfree(bfqg);
453+ bfqg_put(bfqg);
430454 }
431455
432456 void bfq_pd_reset_stats(struct blkg_policy_data *pd)
@@ -496,9 +520,10 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, · 63 unmodified lines
496520 * Move @bfqq to @bfqg, deactivating it from its old group and reactivating
497521 * it on the new one. Avoid putting the entity on the old group idle tree.
498522 *
499− * Must be called under the queue lock; the cgroup owning @bfqg must
500− * not disappear (by now this just means that we are called under
501− * rcu_read_lock()).
523+ * Must be called under the scheduler lock, to make sure that the blkg
524+ * owning @bfqg does not disappear (see comments in
525+ * bfq_bic_update_cgroup on guaranteeing the consistency of blkg
526+ * objects).
502527 */
503528 void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
504529 struct bfq_group *bfqg)
@@ -519,16 +544,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, · 14 unmodified lines
519544 bfq_deactivate_bfqq(bfqd, bfqq, false, false);
520545 else if (entity->on_st)
521546 bfq_put_idle_entity(bfq_entity_service_tree(entity), entity);
522− bfqg_put(bfqq_group(bfqq));
547+ bfqg_and_blkg_put(bfqq_group(bfqq));
523548
524− /*
525− * Here we use a reference to bfqg. We don't need a refcounter
526− * as the cgroup reference will not be dropped, so that its
527− * destroy() callback will not be invoked.
528− */
529549 entity->parent = bfqg->my_entity;
530550 entity->sched_data = &bfqg->sched_data;
531− bfqg_get(bfqg);
551+ /* pin down bfqg and its associated blkg */
552+ bfqg_and_blkg_get(bfqg);
532553
533554 if (bfq_bfqq_busy(bfqq)) {
534555 bfq_pos_tree_add_move(bfqd, bfqq);
@@ -545,8 +566,9 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, · 10 unmodified lines
545566 * @bic: the bic to move.
546567 * @blkcg: the blk-cgroup to move to.
547568 *
548− * Move bic to blkcg, assuming that bfqd->queue is locked; the caller
549− * has to make sure that the reference to cgroup is valid across the call.
569+ * Move bic to blkcg, assuming that bfqd->lock is held; which makes
570+ * sure that the reference to cgroup is valid across the call (see
571+ * comments in bfq_bic_update_cgroup on this issue)
550572 *
551573 * NOTE: an alternative approach might have been to store the current
552574 * cgroup in bfqq and getting a reference to it, reducing the lookup
@@ -604,6 +626,57 @@ void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio) · 51 unmodified lines
604626 goto out;
605627
606628 bfqg = __bfq_bic_change_cgroup(bfqd, bic, bio_blkcg(bio));
629+ /*
630+ * Update blkg_path for bfq_log_* functions. We cache this
631+ * path, and update it here, for the following
632+ * reasons. Operations on blkg objects in blk-cgroup are
633+ * protected with the request_queue lock, and not with the
634+ * lock that protects the instances of this scheduler
635+ * (bfqd->lock). This exposes BFQ to the following sort of
636+ * race.
637+ *
638+ * The blkg_lookup performed in bfq_get_queue, protected
639+ * through rcu, may happen to return the address of a copy of
640+ * the original blkg. If this is the case, then the
641+ * bfqg_and_blkg_get performed in bfq_get_queue, to pin down
642+ * the blkg, is useless: it does not prevent blk-cgroup code
643+ * from destroying both the original blkg and all objects
644+ * directly or indirectly referred by the copy of the
645+ * blkg.
646+ *
647+ * On the bright side, destroy operations on a blkg invoke, as
648+ * a first step, hooks of the scheduler associated with the
649+ * blkg. And these hooks are executed with bfqd->lock held for
650+ * BFQ. As a consequence, for any blkg associated with the
651+ * request queue this instance of the scheduler is attached
652+ * to, we are guaranteed that such a blkg is not destroyed, and
653+ * that all the pointers it contains are consistent, while we
654+ * are holding bfqd->lock. A blkg_lookup performed with
655+ * bfqd->lock held then returns a fully consistent blkg, which
656+ * remains consistent until this lock is held.
657+ *
658+ * Thanks to the last fact, and to the fact that: (1) bfqg has
659+ * been obtained through a blkg_lookup in the above
660+ * assignment, and (2) bfqd->lock is being held, here we can
661+ * safely use the policy data for the involved blkg (i.e., the
662+ * field bfqg->pd) to get to the blkg associated with bfqg,
663+ * and then we can safely use any field of blkg. After we
664+ * release bfqd->lock, even just getting blkg through this
665+ * bfqg may cause dangling references to be traversed, as
666+ * bfqg->pd may not exist any more.
667+ *
668+ * In view of the above facts, here we cache, in the bfqg, any
669+ * blkg data we may need for this bic, and for its associated
670+ * bfq_queue. As of now, we need to cache only the path of the
671+ * blkg, which is used in the bfq_log_* functions.
672+ *
673+ * Finally, note that bfqg itself needs to be protected from
674+ * destruction on the blkg_free of the original blkg (which
675+ * invokes bfq_pd_free). We use an additional private
676+ * refcounter for bfqg, to let it disappear only after no
677+ * bfq_queue refers to it any longer.
678+ */
679+ blkg_path(bfqg_to_blkg(bfqg), bfqg->blkg_path, sizeof(bfqg->blkg_path));
607680 bic->blkcg_serial_nr = serial_nr;
608681 out:
609682 rcu_read_unlock();
@@ -640,8 +713,6 @@ static void bfq_reparent_leaf_entity(struct bfq_data *bfqd, · 30 unmodified lines
640713 * @bfqd: the device data structure with the root group.
641714 * @bfqg: the group to move from.
642715 * @st: the service tree with the entities.
643− *
644− * Needs queue_lock to be taken and reference to be valid over the call.
645716 */
646717 static void bfq_reparent_active_entities(struct bfq_data *bfqd,
647718 struct bfq_group *bfqg,
@@ -692,8 +763,7 @@ void bfq_pd_offline(struct blkg_policy_data *pd) · 44 unmodified lines
692763 /*
693764 * The idle tree may still contain bfq_queues belonging
694765 * to exited task because they never migrated to a different
695− * cgroup from the one being destroyed now. No one else
696− * can access them so it's safe to act without any lock.
766+ * cgroup from the one being destroyed now.
697767 */
698768 bfq_flush_idle_tree(st);
699769
block/bfq-iosched.c+1−1
@@ -3665,7 +3665,7 @@ void bfq_put_queue(struct bfq_queue *bfqq) · 3664 unmodified lines
36653665
36663666 kmem_cache_free(bfq_pool, bfqq);
36673667 #ifdef CONFIG_BFQ_GROUP_IOSCHED
3668− bfqg_put(bfqg);
3668+ bfqg_and_blkg_put(bfqg);
36693669 #endif
36703670 }
36713671
block/bfq-iosched.h+11−12
@@ -759,6 +759,12 @@ struct bfq_group { · 758 unmodified lines
759759 /* must be the first member */
760760 struct blkg_policy_data pd;
761761
762+ /* cached path for this blkg (see comments in bfq_bic_update_cgroup) */
763+ char blkg_path[128];
764+
765+ /* reference counter (see comments in bfq_bic_update_cgroup) */
766+ int ref;
767+
762768 struct bfq_entity entity;
763769 struct bfq_sched_data sched_data;
764770
@@ -838,7 +844,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, · 73 unmodified lines
838844 struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg);
839845 struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
840846 struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node);
841−void bfqg_put(struct bfq_group *bfqg);
847+void bfqg_and_blkg_put(struct bfq_group *bfqg);
842848
843849 #ifdef CONFIG_BFQ_GROUP_IOSCHED
844850 extern struct cftype bfq_blkcg_legacy_files[];
@@ -910,20 +916,13 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq); · 65 unmodified lines
910916 struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
911917
912918 #define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \
913− char __pbuf[128]; \
914− \
915− blkg_path(bfqg_to_blkg(bfqq_group(bfqq)), __pbuf, sizeof(__pbuf)); \
916− blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid, \
919+ blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid,\
917920 bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \
918− __pbuf, ##args); \
921+ bfqq_group(bfqq)->blkg_path, ##args); \
919922 } while (0)
920923
921−#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \
922− char __pbuf[128]; \
923− \
924− blkg_path(bfqg_to_blkg(bfqg), __pbuf, sizeof(__pbuf)); \
925− blk_add_trace_msg((bfqd)->queue, "%s " fmt, __pbuf, ##args); \
926−} while (0)
924+#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) \
925+ blk_add_trace_msg((bfqd)->queue, "%s " fmt, (bfqg)->blkg_path, ##args)
927926
928927 #else /* CONFIG_BFQ_GROUP_IOSCHED */
929928
block/bio-integrity.c+3−0
@@ -175,6 +175,9 @@ bool bio_integrity_enabled(struct bio *bio) · 174 unmodified lines
175175 if (bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE)
176176 return false;
177177
178+ if (!bio_sectors(bio))
179+ return false;
180+
178181 /* Already protected? */
179182 if (bio_integrity(bio))
180183 return false;
block/blk-mq.c+17−8
@@ -1461,22 +1461,28 @@ static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq) · 1460 unmodified lines
14611461 return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true);
14621462 }
14631463
1464−static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
1465− bool may_sleep)
1464+static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
1465+ struct request *rq,
1466+ blk_qc_t *cookie, bool may_sleep)
14661467 {
14671468 struct request_queue *q = rq->q;
14681469 struct blk_mq_queue_data bd = {
14691470 .rq = rq,
14701471 .last = true,
14711472 };
1472− struct blk_mq_hw_ctx *hctx;
14731473 blk_qc_t new_cookie;
14741474 int ret;
1475+ bool run_queue = true;
1476+
1477+ if (blk_mq_hctx_stopped(hctx)) {
1478+ run_queue = false;
1479+ goto insert;
1480+ }
14751481
14761482 if (q->elevator)
14771483 goto insert;
14781484
1479− if (!blk_mq_get_driver_tag(rq, &hctx, false))
1485+ if (!blk_mq_get_driver_tag(rq, NULL, false))
14801486 goto insert;
14811487
14821488 new_cookie = request_to_qc_t(hctx, rq);
@@ -1500,7 +1506,7 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, · 17 unmodified lines
15001506
15011507 __blk_mq_requeue_request(rq);
15021508 insert:
1503− blk_mq_sched_insert_request(rq, false, true, false, may_sleep);
1509+ blk_mq_sched_insert_request(rq, false, run_queue, false, may_sleep);
15041510 }
15051511
15061512 static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
@@ -1508,7 +1514,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line
15081514 {
15091515 if (!(hctx->flags & BLK_MQ_F_BLOCKING)) {
15101516 rcu_read_lock();
1511− __blk_mq_try_issue_directly(rq, cookie, false);
1517+ __blk_mq_try_issue_directly(hctx, rq, cookie, false);
15121518 rcu_read_unlock();
15131519 } else {
15141520 unsigned int srcu_idx;
@@ -1516,7 +1522,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line
15161522 might_sleep();
15171523
15181524 srcu_idx = srcu_read_lock(&hctx->queue_rq_srcu);
1519− __blk_mq_try_issue_directly(rq, cookie, true);
1525+ __blk_mq_try_issue_directly(hctx, rq, cookie, true);
15201526 srcu_read_unlock(&hctx->queue_rq_srcu, srcu_idx);
15211527 }
15221528 }
@@ -1619,9 +1625,12 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 96 unmodified lines
16191625
16201626 blk_mq_put_ctx(data.ctx);
16211627
1622− if (same_queue_rq)
1628+ if (same_queue_rq) {
1629+ data.hctx = blk_mq_map_queue(q,
1630+ same_queue_rq->mq_ctx->cpu);
16231631 blk_mq_try_issue_directly(data.hctx, same_queue_rq,
16241632 &cookie);
1633+ }
16251634 } else if (q->nr_hw_queues > 1 && is_sync) {
16261635 blk_mq_put_ctx(data.ctx);
16271636 blk_mq_bio_to_request(rq, bio);
block/blk-throttle.c+18−4
@@ -27,6 +27,13 @@ static int throtl_quantum = 32; · 26 unmodified lines
2727 #define MIN_THROTL_IOPS (10)
2828 #define DFL_LATENCY_TARGET (-1L)
2929 #define DFL_IDLE_THRESHOLD (0)
30+#define DFL_HD_BASELINE_LATENCY (4000L) /* 4ms */
31+#define LATENCY_FILTERED_SSD (0)
32+/*
33+ * For HD, very small latency comes from sequential IO. Such IO is helpless to
34+ * help determine if its IO is impacted by others, hence we ignore the IO
35+ */
36+#define LATENCY_FILTERED_HD (1000L) /* 1ms */
3037
3138 #define SKIP_LATENCY (((u64)1) << BLK_STAT_RES_SHIFT)
3239
@@ -212,6 +219,7 @@ struct throtl_data · 179 unmodified lines
212219 struct avg_latency_bucket avg_buckets[LATENCY_BUCKET_SIZE];
213220 struct latency_bucket __percpu *latency_buckets;
214221 unsigned long last_calculate_time;
222+ unsigned long filtered_latency;
215223
216224 bool track_bio_latency;
217225 };
@@ -698,7 +706,7 @@ static void throtl_dequeue_tg(struct throtl_grp *tg) · 480 unmodified lines
698706 static void throtl_schedule_pending_timer(struct throtl_service_queue *sq,
699707 unsigned long expires)
700708 {
701− unsigned long max_expire = jiffies + 8 * sq_to_tg(sq)->td->throtl_slice;
709+ unsigned long max_expire = jiffies + 8 * sq_to_td(sq)->throtl_slice;
702710
703711 /*
704712 * Since we are adjusting the throttle limit dynamically, the sleep
@@ -2281,7 +2289,7 @@ void blk_throtl_bio_endio(struct bio *bio) · 1576 unmodified lines
22812289 throtl_track_latency(tg->td, blk_stat_size(&bio->bi_issue_stat),
22822290 bio_op(bio), lat);
22832291
2284− if (tg->latency_target) {
2292+ if (tg->latency_target && lat >= tg->td->filtered_latency) {
22852293 int bucket;
22862294 unsigned int threshold;
22872295
@@ -2417,14 +2425,20 @@ void blk_throtl_exit(struct request_queue *q) · 129 unmodified lines
24172425 void blk_throtl_register_queue(struct request_queue *q)
24182426 {
24192427 struct throtl_data *td;
2428+ int i;
24202429
24212430 td = q->td;
24222431 BUG_ON(!td);
24232432
2424− if (blk_queue_nonrot(q))
2433+ if (blk_queue_nonrot(q)) {
24252434 td->throtl_slice = DFL_THROTL_SLICE_SSD;
2426− else
2435+ td->filtered_latency = LATENCY_FILTERED_SSD;
2436+ } else {
24272437 td->throtl_slice = DFL_THROTL_SLICE_HD;
2438+ td->filtered_latency = LATENCY_FILTERED_HD;
2439+ for (i = 0; i < LATENCY_BUCKET_SIZE; i++)
2440+ td->avg_buckets[i].latency = DFL_HD_BASELINE_LATENCY;
2441+ }
24282442 #ifndef CONFIG_BLK_DEV_THROTTLING_LOW
24292443 /* if no low limit, use previous default */
24302444 td->throtl_slice = DFL_THROTL_SLICE_HD;
crypto/asymmetric_keys/public_key.c+1−1
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey, · 140 unmodified lines
141141 * signature and returns that to us.
142142 */
143143 ret = crypto_akcipher_verify(req);
144− if (ret == -EINPROGRESS) {
144+ if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
145145 wait_for_completion(&compl.completion);
146146 ret = compl.err;
147147 }
crypto/asymmetric_keys/verify_pefile.c+2−2
@@ -381,7 +381,7 @@ static int pefile_digest_pe(const void *pebuf, unsigned int pelen, · 380 unmodified lines
381381 }
382382
383383 error:
384− kfree(desc);
384+ kzfree(desc);
385385 error_no_desc:
386386 crypto_free_shash(tfm);
387387 kleave(" = %d", ret);
@@ -450,6 +450,6 @@ int verify_pefile_signature(const void *pebuf, unsigned pelen, · 62 unmodified lines
450450 ret = pefile_digest_pe(pebuf, pelen, &ctx);
451451
452452 error:
453− kfree(ctx.digest);
453+ kzfree(ctx.digest);
454454 return ret;
455455 }
crypto/asymmetric_keys/x509_cert_parser.c+1−0
@@ -102,6 +102,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen) · 101 unmodified lines
102102 }
103103 }
104104
105+ ret = -ENOMEM;
105106 cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL);
106107 if (!cert->pub->key)
107108 goto error_decode;
crypto/drbg.c+2−3
@@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, · 1766 unmodified lines
17671767 break;
17681768 case -EINPROGRESS:
17691769 case -EBUSY:
1770− ret = wait_for_completion_interruptible(
1771− &drbg->ctr_completion);
1772− if (!ret && !drbg->ctr_async_err) {
1770+ wait_for_completion(&drbg->ctr_completion);
1771+ if (!drbg->ctr_async_err) {
17731772 reinit_completion(&drbg->ctr_completion);
17741773 break;
17751774 }
crypto/gcm.c+2−4
@@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key, · 151 unmodified lines
152152
153153 err = crypto_skcipher_encrypt(&data->req);
154154 if (err == -EINPROGRESS || err == -EBUSY) {
155− err = wait_for_completion_interruptible(
156− &data->result.completion);
157− if (!err)
158− err = data->result.err;
155+ wait_for_completion(&data->result.completion);
156+ err = data->result.err;
159157 }
160158
161159 if (err)
drivers/acpi/acpica/tbutils.c+25−9
@@ -416,9 +416,18 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc, · 415 unmodified lines
416416 }
417417 }
418418
419− table_desc->validation_count++;
420− if (table_desc->validation_count == 0) {
421− table_desc->validation_count--;
419+ if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
420+ table_desc->validation_count++;
421+
422+ /*
423+ * Detect validation_count overflows to ensure that the warning
424+ * message will only be printed once.
425+ */
426+ if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
427+ ACPI_WARNING((AE_INFO,
428+ "Table %p, Validation count overflows\n",
429+ table_desc));
430+ }
422431 }
423432
424433 *out_table = table_desc->pointer;
@@ -445,13 +454,20 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc) · 20 unmodified lines
445454
446455 ACPI_FUNCTION_TRACE(acpi_tb_put_table);
447456
448− if (table_desc->validation_count == 0) {
449− ACPI_WARNING((AE_INFO,
450− "Table %p, Validation count is zero before decrement\n",
451− table_desc));
452− return_VOID;
457+ if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
458+ table_desc->validation_count--;
459+
460+ /*
461+ * Detect validation_count underflows to ensure that the warning
462+ * message will only be printed once.
463+ */
464+ if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
465+ ACPI_WARNING((AE_INFO,
466+ "Table %p, Validation count underflows\n",
467+ table_desc));
468+ return_VOID;
469+ }
453470 }
454− table_desc->validation_count--;
455471
456472 if (table_desc->validation_count == 0) {
457473
drivers/acpi/acpica/utresrc.c+0−9
@@ -474,15 +474,6 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, · 473 unmodified lines
474474 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
475475 }
476476
477− /*
478− * The end_tag opcode must be followed by a zero byte.
479− * Although this byte is technically defined to be a checksum,
480− * in practice, all ASL compilers set this byte to zero.
481− */
482− if (*(aml + 1) != 0) {
483− return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
484− }
485−
486477 /* Return the pointer to the end_tag if requested */
487478
488479 if (!user_function) {
drivers/acpi/arm64/iort.c+14−8
@@ -666,14 +666,6 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev, · 665 unmodified lines
666666 int ret = -ENODEV;
667667 struct fwnode_handle *iort_fwnode;
668668
669− /*
670− * If we already translated the fwspec there
671− * is nothing left to do, return the iommu_ops.
672− */
673− ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
674− if (ops)
675− return ops;
676−
677669 if (node) {
678670 iort_fwnode = iort_get_fwnode(node);
679671 if (!iort_fwnode)
@@ -735,6 +727,14 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) · 55 unmodified lines
735727 u32 streamid = 0;
736728 int err;
737729
730+ /*
731+ * If we already translated the fwspec there
732+ * is nothing left to do, return the iommu_ops.
733+ */
734+ ops = iort_fwspec_iommu_ops(dev->iommu_fwspec);
735+ if (ops)
736+ return ops;
737+
738738 if (dev_is_pci(dev)) {
739739 struct pci_bus *bus = to_pci_dev(dev)->bus;
740740 u32 rid;
@@ -782,6 +782,12 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) · 41 unmodified lines
782782 if (err)
783783 ops = ERR_PTR(err);
784784
785+ /* Ignore all other errors apart from EPROBE_DEFER */
786+ if (IS_ERR(ops) && (PTR_ERR(ops) != -EPROBE_DEFER)) {
787+ dev_dbg(dev, "Adding to IOMMU failed: %ld\n", PTR_ERR(ops));
788+ ops = NULL;
789+ }
790+
785791 return ops;
786792 }
787793
drivers/acpi/battery.c+1−1
@@ -782,7 +782,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume) · 781 unmodified lines
782782 if ((battery->state & ACPI_BATTERY_STATE_CRITICAL) ||
783783 (test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags) &&
784784 (battery->capacity_now <= battery->alarm)))
785− pm_wakeup_hard_event(&battery->device->dev);
785+ pm_wakeup_event(&battery->device->dev, 0);
786786
787787 return result;
788788 }
drivers/acpi/button.c+2−3
@@ -217,7 +217,7 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) · 216 unmodified lines
217217 }
218218
219219 if (state)
220− pm_wakeup_hard_event(&device->dev);
220+ pm_wakeup_event(&device->dev, 0);
221221
222222 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
223223 if (ret == NOTIFY_DONE)
@@ -402,7 +402,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 178 unmodified lines
402402 } else {
403403 int keycode;
404404
405− pm_wakeup_hard_event(&device->dev);
405+ pm_wakeup_event(&device->dev, 0);
406406 if (button->suspended)
407407 break;
408408
@@ -534,7 +534,6 @@ static int acpi_button_add(struct acpi_device *device) · 125 unmodified lines
534534 lid_device = device;
535535 }
536536
537− device_init_wakeup(&device->dev, true);
538537 printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
539538 return 0;
540539
drivers/acpi/device_pm.c+1−2
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <linux/pm_qos.h>
2525 #include <linux/pm_domain.h>
2626 #include <linux/pm_runtime.h>
27−#include <linux/suspend.h>
2827
2928 #include "internal.h"
3029
@@ -400,7 +399,7 @@ static void acpi_pm_notify_handler(acpi_handle handle, u32 val, void *not_used) · 369 unmodified lines
400399 mutex_lock(&acpi_pm_notifier_lock);
401400
402401 if (adev->wakeup.flags.notifier_present) {
403− pm_wakeup_ws_event(adev->wakeup.ws, 0, true);
402+ __pm_wakeup_event(adev->wakeup.ws, 0);
404403 if (adev->wakeup.context.work.func)
405404 queue_pm_work(&adev->wakeup.context.work);
406405 }
drivers/acpi/scan.c+2−2
@@ -1371,8 +1371,8 @@ int acpi_dma_configure(struct device *dev, enum dev_dma_attr attr) · 1370 unmodified lines
13711371 iort_set_dma_mask(dev);
13721372
13731373 iommu = iort_iommu_configure(dev);
1374− if (IS_ERR(iommu))
1375− return PTR_ERR(iommu);
1374+ if (IS_ERR(iommu) && PTR_ERR(iommu) == -EPROBE_DEFER)
1375+ return -EPROBE_DEFER;
13761376
13771377 size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1);
13781378 /*
drivers/acpi/sleep.c+0−28
@@ -663,40 +663,14 @@ static int acpi_freeze_prepare(void) · 662 unmodified lines
663663 acpi_os_wait_events_complete();
664664 if (acpi_sci_irq_valid())
665665 enable_irq_wake(acpi_sci_irq);
666−
667666 return 0;
668667 }
669668
670−static void acpi_freeze_wake(void)
671−{
672− /*
673− * If IRQD_WAKEUP_ARMED is not set for the SCI at this point, it means
674− * that the SCI has triggered while suspended, so cancel the wakeup in
675− * case it has not been a wakeup event (the GPEs will be checked later).
676− */
677− if (acpi_sci_irq_valid() &&
678− !irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq)))
679− pm_system_cancel_wakeup();
680−}
681−
682−static void acpi_freeze_sync(void)
683−{
684− /*
685− * Process all pending events in case there are any wakeup ones.
686− *
687− * The EC driver uses the system workqueue, so that one needs to be
688− * flushed too.
689− */
690− acpi_os_wait_events_complete();
691− flush_scheduled_work();
692−}
693−
694669 static void acpi_freeze_restore(void)
695670 {
696671 acpi_disable_wakeup_devices(ACPI_STATE_S0);
697672 if (acpi_sci_irq_valid())
698673 disable_irq_wake(acpi_sci_irq);
699−
700674 acpi_enable_all_runtime_gpes();
701675 }
702676
@@ -708,8 +682,6 @@ static void acpi_freeze_end(void) · 5 unmodified lines
708682 static const struct platform_freeze_ops acpi_freeze_ops = {
709683 .begin = acpi_freeze_begin,
710684 .prepare = acpi_freeze_prepare,
711− .wake = acpi_freeze_wake,
712− .sync = acpi_freeze_sync,
713685 .restore = acpi_freeze_restore,
714686 .end = acpi_freeze_end,
715687 };
drivers/base/power/main.c+5−0
@@ -1091,6 +1091,11 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a · 1090 unmodified lines
10911091 if (async_error)
10921092 goto Complete;
10931093
1094+ if (pm_wakeup_pending()) {
1095+ async_error = -EBUSY;
1096+ goto Complete;
1097+ }
1098+
10941099 if (dev->power.syscore || dev->power.direct_complete)
10951100 goto Complete;
10961101
drivers/base/power/wakeup.c+6−12
@@ -28,8 +28,8 @@ bool events_check_enabled __read_mostly; · 27 unmodified lines
2828 /* First wakeup IRQ seen by the kernel in the last cycle. */
2929 unsigned int pm_wakeup_irq __read_mostly;
3030
31−/* If greater than 0 and the system is suspending, terminate the suspend. */
32−static atomic_t pm_abort_suspend __read_mostly;
31+/* If set and the system is suspending, terminate the suspend. */
32+static bool pm_abort_suspend __read_mostly;
3333
3434 /*
3535 * Combined counters of registered wakeup events and wakeup events in progress.
@@ -855,26 +855,20 @@ bool pm_wakeup_pending(void) · 819 unmodified lines
855855 pm_print_active_wakeup_sources();
856856 }
857857
858− return ret || atomic_read(&pm_abort_suspend) > 0;
858+ return ret || pm_abort_suspend;
859859 }
860860
861861 void pm_system_wakeup(void)
862862 {
863− atomic_inc(&pm_abort_suspend);
863+ pm_abort_suspend = true;
864864 freeze_wake();
865865 }
866866 EXPORT_SYMBOL_GPL(pm_system_wakeup);
867867
868−void pm_system_cancel_wakeup(void)
869−{
870− atomic_dec(&pm_abort_suspend);
871−}
872−
873−void pm_wakeup_clear(bool reset)
868+void pm_wakeup_clear(void)
874869 {
870+ pm_abort_suspend = false;
875871 pm_wakeup_irq = 0;
876− if (reset)
877− atomic_set(&pm_abort_suspend, 0);
878872 }
879873
880874 void pm_system_irq_wakeup(unsigned int irq_number)
drivers/block/loop.c+3−0
@@ -608,6 +608,9 @@ static int loop_switch(struct loop_device *lo, struct file *file) · 607 unmodified lines
608608 */
609609 static int loop_flush(struct loop_device *lo)
610610 {
611+ /* loop not yet configured, no running thread, nothing to flush */
612+ if (lo->lo_state != Lo_bound)
613+ return 0;
611614 return loop_switch(lo, NULL);
612615 }
613616
drivers/char/mem.c+1−1
@@ -343,7 +343,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma) · 342 unmodified lines
343343 phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
344344
345345 /* It's illegal to wrap around the end of the physical address space. */
346− if (offset + (phys_addr_t)size < offset)
346+ if (offset + (phys_addr_t)size - 1 < offset)
347347 return -EINVAL;
348348
349349 if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
drivers/char/random.c+43−6
@@ -1,6 +1,9 @@
11 /*
22 * random.c -- A strong random number generator
33 *
4+ * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All
5+ * Rights Reserved.
6+ *
47 * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
58 *
69 * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All
@@ -762,6 +765,8 @@ static DECLARE_WAIT_QUEUE_HEAD(crng_init_wait); · 755 unmodified lines
762765 static struct crng_state **crng_node_pool __read_mostly;
763766 #endif
764767
768+static void invalidate_batched_entropy(void);
769+
765770 static void crng_initialize(struct crng_state *crng)
766771 {
767772 int i;
@@ -799,6 +804,7 @@ static int crng_fast_load(const char *cp, size_t len) · 31 unmodified lines
799804 cp++; crng_init_cnt++; len--;
800805 }
801806 if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) {
807+ invalidate_batched_entropy();
802808 crng_init = 1;
803809 wake_up_interruptible(&crng_init_wait);
804810 pr_notice("random: fast init done\n");
@@ -836,6 +842,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 31 unmodified lines
836842 memzero_explicit(&buf, sizeof(buf));
837843 crng->init_time = jiffies;
838844 if (crng == &primary_crng && crng_init < 2) {
845+ invalidate_batched_entropy();
839846 crng_init = 2;
840847 process_random_ready_list();
841848 wake_up_interruptible(&crng_init_wait);
@@ -1097,15 +1104,15 @@ static void add_interrupt_bench(cycles_t start) · 255 unmodified lines
10971104 static __u32 get_reg(struct fast_pool *f, struct pt_regs *regs)
10981105 {
10991106 __u32 *ptr = (__u32 *) regs;
1100− unsigned long flags;
1107+ unsigned int idx;
11011108
11021109 if (regs == NULL)
11031110 return 0;
1104− local_irq_save(flags);
1105− if (f->reg_idx >= sizeof(struct pt_regs) / sizeof(__u32))
1106− f->reg_idx = 0;
1107− ptr += f->reg_idx++;
1108− local_irq_restore(flags);
1111+ idx = READ_ONCE(f->reg_idx);
1112+ if (idx >= sizeof(struct pt_regs) / sizeof(__u32))
1113+ idx = 0;
1114+ ptr += idx++;
1115+ WRITE_ONCE(f->reg_idx, idx);
11091116 return *ptr;
11101117 }
11111118
@@ -2023,6 +2030,7 @@ struct batched_entropy { · 911 unmodified lines
20232030 };
20242031 unsigned int position;
20252032 };
2033+static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_reset_lock);
20262034
20272035 /*
20282036 * Get a random word for internal kernel use only. The quality of the random
@@ -2033,6 +2041,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); · 4 unmodified lines
20332041 u64 get_random_u64(void)
20342042 {
20352043 u64 ret;
2044+ bool use_lock = crng_init < 2;
2045+ unsigned long flags;
20362046 struct batched_entropy *batch;
20372047
20382048 #if BITS_PER_LONG == 64
@@ -2045,11 +2055,15 @@ u64 get_random_u64(void) · 6 unmodified lines
20452055 #endif
20462056
20472057 batch = &get_cpu_var(batched_entropy_u64);
2058+ if (use_lock)
2059+ read_lock_irqsave(&batched_entropy_reset_lock, flags);
20482060 if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) {
20492061 extract_crng((u8 *)batch->entropy_u64);
20502062 batch->position = 0;
20512063 }
20522064 ret = batch->entropy_u64[batch->position++];
2065+ if (use_lock)
2066+ read_unlock_irqrestore(&batched_entropy_reset_lock, flags);
20532067 put_cpu_var(batched_entropy_u64);
20542068 return ret;
20552069 }
@@ -2059,22 +2073,45 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); · 3 unmodified lines
20592073 u32 get_random_u32(void)
20602074 {
20612075 u32 ret;
2076+ bool use_lock = crng_init < 2;
2077+ unsigned long flags;
20622078 struct batched_entropy *batch;
20632079
20642080 if (arch_get_random_int(&ret))
20652081 return ret;
20662082
20672083 batch = &get_cpu_var(batched_entropy_u32);
2084+ if (use_lock)
2085+ read_lock_irqsave(&batched_entropy_reset_lock, flags);
20682086 if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) {
20692087 extract_crng((u8 *)batch->entropy_u32);
20702088 batch->position = 0;
20712089 }
20722090 ret = batch->entropy_u32[batch->position++];
2091+ if (use_lock)
2092+ read_unlock_irqrestore(&batched_entropy_reset_lock, flags);
20732093 put_cpu_var(batched_entropy_u32);
20742094 return ret;
20752095 }
20762096 EXPORT_SYMBOL(get_random_u32);
20772097
2098+/* It's important to invalidate all potential batched entropy that might
2099+ * be stored before the crng is initialized, which we can do lazily by
2100+ * simply resetting the counter to zero so that it's re-extracted on the
2101+ * next usage. */
2102+static void invalidate_batched_entropy(void)
2103+{
2104+ int cpu;
2105+ unsigned long flags;
2106+
2107+ write_lock_irqsave(&batched_entropy_reset_lock, flags);
2108+ for_each_possible_cpu (cpu) {
2109+ per_cpu_ptr(&batched_entropy_u32, cpu)->position = 0;
2110+ per_cpu_ptr(&batched_entropy_u64, cpu)->position = 0;
2111+ }
2112+ write_unlock_irqrestore(&batched_entropy_reset_lock, flags);
2113+}
2114+
20782115 /**
20792116 * randomize_page - Generate a random, page aligned address
20802117 * @start: The smallest acceptable address the caller will take.
drivers/cpufreq/cpufreq_conservative.c+2−2
@@ -185,8 +185,8 @@ static ssize_t store_down_threshold(struct gov_attr_set *attr_set, · 184 unmodified lines
185185 int ret;
186186 ret = sscanf(buf, "%u", &input);
187187
188− /* cannot be lower than 11 otherwise freq will not fall */
189− if (ret != 1 || input < 11 || input > 100 ||
188+ /* cannot be lower than 1 otherwise freq will not fall */
189+ if (ret != 1 || input < 1 || input > 100 ||
190190 input >= dbs_data->up_threshold)
191191 return -EINVAL;
192192
drivers/cpufreq/intel_pstate.c+3−2
@@ -571,9 +571,10 @@ static inline void update_turbo_state(void) · 570 unmodified lines
571571 static int min_perf_pct_min(void)
572572 {
573573 struct cpudata *cpu = all_cpu_data[0];
574+ int turbo_pstate = cpu->pstate.turbo_pstate;
574575
575− return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
576− cpu->pstate.turbo_pstate);
576+ return turbo_pstate ?
577+ DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
577578 }
578579
579580 static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
drivers/cpuidle/dt_idle_states.c+3−1
@@ -180,8 +180,10 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, · 179 unmodified lines
180180 if (!state_node)
181181 break;
182182
183− if (!of_device_is_available(state_node))
183+ if (!of_device_is_available(state_node)) {
184+ of_node_put(state_node);
184185 continue;
186+ }
185187
186188 if (!idle_state_valid(state_node, i, cpumask)) {
187189 pr_warn("%s idle state not valid, bailing out\n",
drivers/dax/super.c+7−2
@@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax); · 209 unmodified lines
210210 static struct inode *dax_alloc_inode(struct super_block *sb)
211211 {
212212 struct dax_device *dax_dev;
213+ struct inode *inode;
213214
214215 dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL);
215− return &dax_dev->inode;
216+ inode = &dax_dev->inode;
217+ inode->i_rdev = 0;
218+ return inode;
216219 }
217220
218221 static struct dax_device *to_dax_dev(struct inode *inode)
@@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head) · 8 unmodified lines
227230
228231 kfree(dax_dev->host);
229232 dax_dev->host = NULL;
230− ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
233+ if (inode->i_rdev)
234+ ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
231235 kmem_cache_free(dax_cache, dax_dev);
232236 }
233237
@@ -423,6 +427,7 @@ static void init_once(void *_dax_dev) · 189 unmodified lines
423427 struct dax_device *dax_dev = _dax_dev;
424428 struct inode *inode = &dax_dev->inode;
425429
430+ memset(dax_dev, 0, sizeof(*dax_dev));
426431 inode_init_once(inode);
427432 }
428433
drivers/devfreq/event/exynos-nocp.c+5−1
@@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev) · 266 unmodified lines
267267 }
268268 platform_set_drvdata(pdev, nocp);
269269
270− clk_prepare_enable(nocp->clk);
270+ ret = clk_prepare_enable(nocp->clk);
271+ if (ret) {
272+ dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
273+ return ret;
274+ }
271275
272276 pr_info("exynos-nocp: new NoC Probe device registered: %s\n",
273277 dev_name(dev));
drivers/devfreq/event/exynos-ppmu.c+6−2
@@ -44,7 +44,7 @@ struct exynos_ppmu { · 43 unmodified lines
4444 { "ppmu-event2-"#name, PPMU_PMNCNT2 }, \
4545 { "ppmu-event3-"#name, PPMU_PMNCNT3 }
4646
47−struct __exynos_ppmu_events {
47+static struct __exynos_ppmu_events {
4848 char *name;
4949 int id;
5050 } ppmu_events[] = {
@@ -648,7 +648,11 @@ static int exynos_ppmu_probe(struct platform_device *pdev) · 597 unmodified lines
648648 dev_name(&pdev->dev), desc[i].name);
649649 }
650650
651− clk_prepare_enable(info->ppmu.clk);
651+ ret = clk_prepare_enable(info->ppmu.clk);
652+ if (ret) {
653+ dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
654+ return ret;
655+ }
652656
653657 return 0;
654658 }
drivers/firmware/efi/efi-bgrt.c+25−1
@@ -27,6 +27,26 @@ struct bmp_header { · 26 unmodified lines
2727 u32 size;
2828 } __packed;
2929
30+static bool efi_bgrt_addr_valid(u64 addr)
31+{
32+ efi_memory_desc_t *md;
33+
34+ for_each_efi_memory_desc(md) {
35+ u64 size;
36+ u64 end;
37+
38+ if (md->type != EFI_BOOT_SERVICES_DATA)
39+ continue;
40+
41+ size = md->num_pages << EFI_PAGE_SHIFT;
42+ end = md->phys_addr + size;
43+ if (addr >= md->phys_addr && addr < end)
44+ return true;
45+ }
46+
47+ return false;
48+}
49+
3050 void __init efi_bgrt_init(struct acpi_table_header *table)
3151 {
3252 void *image;
@@ -36,7 +56,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table) · 3 unmodified lines
3656 if (acpi_disabled)
3757 return;
3858
39− if (!efi_enabled(EFI_BOOT))
59+ if (!efi_enabled(EFI_MEMMAP))
4060 return;
4161
4262 if (table->length < sizeof(bgrt_tab)) {
@@ -65,6 +85,10 @@ void __init efi_bgrt_init(struct acpi_table_header *table) · 22 unmodified lines
6585 goto out;
6686 }
6787
88+ if (!efi_bgrt_addr_valid(bgrt->image_address)) {
89+ pr_notice("Ignoring BGRT: invalid image address\n");
90+ goto out;
91+ }
6892 image = early_memremap(bgrt->image_address, sizeof(bmp_header));
6993 if (!image) {
7094 pr_notice("Ignoring BGRT: failed to map image header memory\n");
drivers/firmware/google/vpd.c+4−4
@@ -136,12 +136,12 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, · 135 unmodified lines
136136 info->value = value;
137137
138138 INIT_LIST_HEAD(&info->list);
139− list_add_tail(&info->list, &sec->attribs);
140139
141140 ret = sysfs_create_bin_file(sec->kobj, &info->bin_attr);
142141 if (ret)
143142 goto free_info_key;
144143
144+ list_add_tail(&info->list, &sec->attribs);
145145 return 0;
146146
147147 free_info_key:
@@ -158,8 +158,8 @@ static void vpd_section_attrib_destroy(struct vpd_section *sec) · 10 unmodified lines
158158 struct vpd_attrib_info *temp;
159159
160160 list_for_each_entry_safe(info, temp, &sec->attribs, list) {
161− kfree(info->key);
162161 sysfs_remove_bin_file(sec->kobj, &info->bin_attr);
162+ kfree(info->key);
163163 kfree(info);
164164 }
165165 }
@@ -244,7 +244,7 @@ static int vpd_section_destroy(struct vpd_section *sec) · 78 unmodified lines
244244 {
245245 if (sec->enabled) {
246246 vpd_section_attrib_destroy(sec);
247− kobject_del(sec->kobj);
247+ kobject_put(sec->kobj);
248248 sysfs_remove_bin_file(vpd_kobj, &sec->bin_attr);
249249 kfree(sec->raw_name);
250250 iounmap(sec->baseaddr);
@@ -331,7 +331,7 @@ static void __exit vpd_platform_exit(void) · 80 unmodified lines
331331 {
332332 vpd_section_destroy(&ro_vpd);
333333 vpd_section_destroy(&rw_vpd);
334− kobject_del(vpd_kobj);
334+ kobject_put(vpd_kobj);
335335 }
336336
337337 module_init(vpd_platform_init);
drivers/gpio/gpio-aspeed.c+3−0
@@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, · 645 unmodified lines
646646 int rc;
647647 int i;
648648
649+ if (!gpio->clk)
650+ return -EINVAL;
651+
649652 rc = usecs_to_cycles(gpio, usecs, &requested_cycles);
650653 if (rc < 0) {
651654 dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n",
drivers/gpio/gpio-crystalcove.c+36−18
@@ -90,8 +90,18 @@ static inline int to_reg(int gpio, enum ctrl_register reg_type) · 89 unmodified lines
9090 {
9191 int reg;
9292
93− if (gpio == 94)
94− return GPIOPANELCTL;
93+ if (gpio >= CRYSTALCOVE_GPIO_NUM) {
94+ /*
95+ * Virtual GPIO called from ACPI, for now we only support
96+ * the panel ctl.
97+ */
98+ switch (gpio) {
99+ case 0x5e:
100+ return GPIOPANELCTL;
101+ default:
102+ return -EOPNOTSUPP;
103+ }
104+ }
95105
96106 if (reg_type == CTRL_IN) {
97107 if (gpio < 8)
@@ -130,36 +140,36 @@ static void crystalcove_update_irq_ctrl(struct crystalcove_gpio *cg, int gpio) · 32 unmodified lines
130140 static int crystalcove_gpio_dir_in(struct gpio_chip *chip, unsigned gpio)
131141 {
132142 struct crystalcove_gpio *cg = gpiochip_get_data(chip);
143+ int reg = to_reg(gpio, CTRL_OUT);
133144
134− if (gpio > CRYSTALCOVE_VGPIO_NUM)
145+ if (reg < 0)
135146 return 0;
136147
137− return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT),
138− CTLO_INPUT_SET);
148+ return regmap_write(cg->regmap, reg, CTLO_INPUT_SET);
139149 }
140150
141151 static int crystalcove_gpio_dir_out(struct gpio_chip *chip, unsigned gpio,
142152 int value)
143153 {
144154 struct crystalcove_gpio *cg = gpiochip_get_data(chip);
155+ int reg = to_reg(gpio, CTRL_OUT);
145156
146− if (gpio > CRYSTALCOVE_VGPIO_NUM)
157+ if (reg < 0)
147158 return 0;
148159
149− return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT),
150− CTLO_OUTPUT_SET | value);
160+ return regmap_write(cg->regmap, reg, CTLO_OUTPUT_SET | value);
151161 }
152162
153163 static int crystalcove_gpio_get(struct gpio_chip *chip, unsigned gpio)
154164 {
155165 struct crystalcove_gpio *cg = gpiochip_get_data(chip);
156− int ret;
157166 unsigned int val;
167+ int ret, reg = to_reg(gpio, CTRL_IN);
158168
159− if (gpio > CRYSTALCOVE_VGPIO_NUM)
169+ if (reg < 0)
160170 return 0;
161171
162− ret = regmap_read(cg->regmap, to_reg(gpio, CTRL_IN), &val);
172+ ret = regmap_read(cg->regmap, reg, &val);
163173 if (ret)
164174 return ret;
165175
@@ -170,14 +180,15 @@ static void crystalcove_gpio_set(struct gpio_chip *chip, · 4 unmodified lines
170180 unsigned gpio, int value)
171181 {
172182 struct crystalcove_gpio *cg = gpiochip_get_data(chip);
183+ int reg = to_reg(gpio, CTRL_OUT);
173184
174− if (gpio > CRYSTALCOVE_VGPIO_NUM)
185+ if (reg < 0)
175186 return;
176187
177188 if (value)
178− regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 1);
189+ regmap_update_bits(cg->regmap, reg, 1, 1);
179190 else
180− regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 0);
191+ regmap_update_bits(cg->regmap, reg, 1, 0);
181192 }
182193
183194 static int crystalcove_irq_type(struct irq_data *data, unsigned type)
@@ -185,6 +196,9 @@ static int crystalcove_irq_type(struct irq_data *data, unsigned type) · 1 unmodified line
185196 struct crystalcove_gpio *cg =
186197 gpiochip_get_data(irq_data_get_irq_chip_data(data));
187198
199+ if (data->hwirq >= CRYSTALCOVE_GPIO_NUM)
200+ return 0;
201+
188202 switch (type) {
189203 case IRQ_TYPE_NONE:
190204 cg->intcnt_value = CTLI_INTCNT_DIS;
@@ -235,8 +249,10 @@ static void crystalcove_irq_unmask(struct irq_data *data) · 44 unmodified lines
235249 struct crystalcove_gpio *cg =
236250 gpiochip_get_data(irq_data_get_irq_chip_data(data));
237251
238− cg->set_irq_mask = false;
239− cg->update |= UPDATE_IRQ_MASK;
252+ if (data->hwirq < CRYSTALCOVE_GPIO_NUM) {
253+ cg->set_irq_mask = false;
254+ cg->update |= UPDATE_IRQ_MASK;
255+ }
240256 }
241257
242258 static void crystalcove_irq_mask(struct irq_data *data)
@@ -244,8 +260,10 @@ static void crystalcove_irq_mask(struct irq_data *data) · 1 unmodified line
244260 struct crystalcove_gpio *cg =
245261 gpiochip_get_data(irq_data_get_irq_chip_data(data));
246262
247− cg->set_irq_mask = true;
248− cg->update |= UPDATE_IRQ_MASK;
263+ if (data->hwirq < CRYSTALCOVE_GPIO_NUM) {
264+ cg->set_irq_mask = true;
265+ cg->update |= UPDATE_IRQ_MASK;
266+ }
249267 }
250268
251269 static struct irq_chip crystalcove_irqchip = {
drivers/gpio/gpio-mvebu.c+8−1
@@ -747,7 +747,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 746 unmodified lines
747747 set = U32_MAX;
748748 else
749749 return -EINVAL;
750− writel_relaxed(0, mvebu_gpioreg_blink_counter_select(mvchip));
750+ writel_relaxed(set, mvebu_gpioreg_blink_counter_select(mvchip));
751751
752752 mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL);
753753 if (!mvpwm)
@@ -768,6 +768,13 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 14 unmodified lines
768768 mvpwm->chip.dev = dev;
769769 mvpwm->chip.ops = &mvebu_pwm_ops;
770770 mvpwm->chip.npwm = mvchip->chip.ngpio;
771+ /*
772+ * There may already be some PWM allocated, so we can't force
773+ * mvpwm->chip.base to a fixed point like mvchip->chip.base.
774+ * So, we let pwmchip_add() do the numbering and take the next free
775+ * region.
776+ */
777+ mvpwm->chip.base = -1;
771778
772779 spin_lock_init(&mvpwm->lock);
773780
drivers/gpu/drm/drm_atomic_helper.c+11−0
@@ -508,6 +508,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 507 unmodified lines
508508 bool has_connectors =
509509 !!new_crtc_state->connector_mask;
510510
511+ WARN_ON(!drm_modeset_is_locked(&crtc->mutex));
512+
511513 if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) {
512514 DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode changed\n",
513515 crtc->base.id, crtc->name);
@@ -551,6 +553,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 37 unmodified lines
551553 for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) {
552554 const struct drm_connector_helper_funcs *funcs = connector->helper_private;
553555
556+ WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
557+
554558 /*
555559 * This only sets crtc->connectors_changed for routing changes,
556560 * drivers must set crtc->connectors_changed themselves when
@@ -650,6 +654,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev, · 93 unmodified lines
650654 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
651655 const struct drm_plane_helper_funcs *funcs;
652656
657+ WARN_ON(!drm_modeset_is_locked(&plane->mutex));
658+
653659 funcs = plane->helper_private;
654660
655661 drm_atomic_helper_plane_changed(state, old_plane_state, new_plane_state, plane);
@@ -2663,7 +2669,12 @@ int drm_atomic_helper_resume(struct drm_device *dev, · 2007 unmodified lines
26632669
26642670 drm_modeset_acquire_init(&ctx, 0);
26652671 while (1) {
2672+ err = drm_modeset_lock_all_ctx(dev, &ctx);
2673+ if (err)
2674+ goto out;
2675+
26662676 err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
2677+out:
26672678 if (err != -EDEADLK)
26682679 break;
26692680
drivers/gpu/drm/drm_drv.c+6−1
@@ -358,7 +358,12 @@ EXPORT_SYMBOL(drm_put_dev); · 357 unmodified lines
358358 void drm_unplug_dev(struct drm_device *dev)
359359 {
360360 /* for a USB device */
361− drm_dev_unregister(dev);
361+ if (drm_core_check_feature(dev, DRIVER_MODESET))
362+ drm_modeset_unregister_all(dev);
363+
364+ drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
365+ drm_minor_unregister(dev, DRM_MINOR_RENDER);
366+ drm_minor_unregister(dev, DRM_MINOR_CONTROL);
362367
363368 mutex_lock(&drm_global_mutex);
364369
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c+1−1
@@ -760,7 +760,7 @@ static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi) · 759 unmodified lines
760760 * Get the endpoint node. In our case, dsi has one output port1
761761 * to which the external HDMI bridge is connected.
762762 */
763− ret = drm_of_find_panel_or_bridge(np, 0, 0, NULL, &dsi->bridge);
763+ ret = drm_of_find_panel_or_bridge(np, 1, 0, NULL, &dsi->bridge);
764764 if (ret)
765765 return ret;
766766
drivers/gpu/drm/i915/i915_drv.c+9−0
@@ -1235,6 +1235,15 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) · 1234 unmodified lines
12351235 goto out_fini;
12361236
12371237 pci_set_drvdata(pdev, &dev_priv->drm);
1238+ /*
1239+ * Disable the system suspend direct complete optimization, which can
1240+ * leave the device suspended skipping the driver's suspend handlers
1241+ * if the device was already runtime suspended. This is needed due to
1242+ * the difference in our runtime and system suspend sequence and
1243+ * becaue the HDA driver may require us to enable the audio power
1244+ * domain during system suspend.
1245+ */
1246+ pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
12381247
12391248 ret = i915_driver_init_early(dev_priv, ent);
12401249 if (ret < 0)
drivers/gpu/drm/i915/i915_drv.h+10−0
@@ -2991,6 +2991,16 @@ static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv) · 2990 unmodified lines
29912991 return false;
29922992 }
29932993
2994+static inline bool
2995+intel_ggtt_update_needs_vtd_wa(struct drm_i915_private *dev_priv)
2996+{
2997+#ifdef CONFIG_INTEL_IOMMU
2998+ if (IS_BROXTON(dev_priv) && intel_iommu_gfx_mapped)
2999+ return true;
3000+#endif
3001+ return false;
3002+}
3003+
29943004 int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
29953005 int enable_ppgtt);
29963006
drivers/gpu/drm/i915/i915_gem.c+4−0
@@ -3298,6 +3298,10 @@ int i915_gem_wait_for_idle(struct drm_i915_private *i915, unsigned int flags) · 3297 unmodified lines
32983298 {
32993299 int ret;
33003300
3301+ /* If the device is asleep, we have no requests outstanding */
3302+ if (!READ_ONCE(i915->gt.awake))
3303+ return 0;
3304+
33013305 if (flags & I915_WAIT_LOCKED) {
33023306 struct i915_gem_timeline *tl;
33033307
drivers/gpu/drm/i915/i915_gem_gtt.c+105−1
@@ -2191,6 +2191,101 @@ static void gen8_ggtt_clear_range(struct i915_address_space *vm, · 2190 unmodified lines
21912191 gen8_set_pte(&gtt_base[i], scratch_pte);
21922192 }
21932193
2194+static void bxt_vtd_ggtt_wa(struct i915_address_space *vm)
2195+{
2196+ struct drm_i915_private *dev_priv = vm->i915;
2197+
2198+ /*
2199+ * Make sure the internal GAM fifo has been cleared of all GTT
2200+ * writes before exiting stop_machine(). This guarantees that
2201+ * any aperture accesses waiting to start in another process
2202+ * cannot back up behind the GTT writes causing a hang.
2203+ * The register can be any arbitrary GAM register.
2204+ */
2205+ POSTING_READ(GFX_FLSH_CNTL_GEN6);
2206+}
2207+
2208+struct insert_page {
2209+ struct i915_address_space *vm;
2210+ dma_addr_t addr;
2211+ u64 offset;
2212+ enum i915_cache_level level;
2213+};
2214+
2215+static int bxt_vtd_ggtt_insert_page__cb(void *_arg)
2216+{
2217+ struct insert_page *arg = _arg;
2218+
2219+ gen8_ggtt_insert_page(arg->vm, arg->addr, arg->offset, arg->level, 0);
2220+ bxt_vtd_ggtt_wa(arg->vm);
2221+
2222+ return 0;
2223+}
2224+
2225+static void bxt_vtd_ggtt_insert_page__BKL(struct i915_address_space *vm,
2226+ dma_addr_t addr,
2227+ u64 offset,
2228+ enum i915_cache_level level,
2229+ u32 unused)
2230+{
2231+ struct insert_page arg = { vm, addr, offset, level };
2232+
2233+ stop_machine(bxt_vtd_ggtt_insert_page__cb, &arg, NULL);
2234+}
2235+
2236+struct insert_entries {
2237+ struct i915_address_space *vm;
2238+ struct sg_table *st;
2239+ u64 start;
2240+ enum i915_cache_level level;
2241+};
2242+
2243+static int bxt_vtd_ggtt_insert_entries__cb(void *_arg)
2244+{
2245+ struct insert_entries *arg = _arg;
2246+
2247+ gen8_ggtt_insert_entries(arg->vm, arg->st, arg->start, arg->level, 0);
2248+ bxt_vtd_ggtt_wa(arg->vm);
2249+
2250+ return 0;
2251+}
2252+
2253+static void bxt_vtd_ggtt_insert_entries__BKL(struct i915_address_space *vm,
2254+ struct sg_table *st,
2255+ u64 start,
2256+ enum i915_cache_level level,
2257+ u32 unused)
2258+{
2259+ struct insert_entries arg = { vm, st, start, level };
2260+
2261+ stop_machine(bxt_vtd_ggtt_insert_entries__cb, &arg, NULL);
2262+}
2263+
2264+struct clear_range {
2265+ struct i915_address_space *vm;
2266+ u64 start;
2267+ u64 length;
2268+};
2269+
2270+static int bxt_vtd_ggtt_clear_range__cb(void *_arg)
2271+{
2272+ struct clear_range *arg = _arg;
2273+
2274+ gen8_ggtt_clear_range(arg->vm, arg->start, arg->length);
2275+ bxt_vtd_ggtt_wa(arg->vm);
2276+
2277+ return 0;
2278+}
2279+
2280+static void bxt_vtd_ggtt_clear_range__BKL(struct i915_address_space *vm,
2281+ u64 start,
2282+ u64 length)
2283+{
2284+ struct clear_range arg = { vm, start, length };
2285+
2286+ stop_machine(bxt_vtd_ggtt_clear_range__cb, &arg, NULL);
2287+}
2288+
21942289 static void gen6_ggtt_clear_range(struct i915_address_space *vm,
21952290 u64 start, u64 length)
21962291 {
@@ -2785,6 +2880,14 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) · 588 unmodified lines
27852880
27862881 ggtt->base.insert_entries = gen8_ggtt_insert_entries;
27872882
2883+ /* Serialize GTT updates with aperture access on BXT if VT-d is on. */
2884+ if (intel_ggtt_update_needs_vtd_wa(dev_priv)) {
2885+ ggtt->base.insert_entries = bxt_vtd_ggtt_insert_entries__BKL;
2886+ ggtt->base.insert_page = bxt_vtd_ggtt_insert_page__BKL;
2887+ if (ggtt->base.clear_range != nop_clear_range)
2888+ ggtt->base.clear_range = bxt_vtd_ggtt_clear_range__BKL;
2889+ }
2890+
27882891 ggtt->invalidate = gen6_ggtt_invalidate;
27892892
27902893 return ggtt_probe_common(ggtt, size);
@@ -2997,7 +3100,8 @@ void i915_ggtt_enable_guc(struct drm_i915_private *i915) · 206 unmodified lines
29973100
29983101 void i915_ggtt_disable_guc(struct drm_i915_private *i915)
29993102 {
3000− i915->ggtt.invalidate = gen6_ggtt_invalidate;
3103+ if (i915->ggtt.invalidate == guc_ggtt_invalidate)
3104+ i915->ggtt.invalidate = gen6_ggtt_invalidate;
30013105 }
30023106
30033107 void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_gem_tiling.c+1−1
@@ -278,7 +278,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 277 unmodified lines
278278 obj->mm.quirked = false;
279279 }
280280 if (!i915_gem_object_is_tiled(obj)) {
281− GEM_BUG_ON(!obj->mm.quirked);
281+ GEM_BUG_ON(obj->mm.quirked);
282282 __i915_gem_object_pin_pages(obj);
283283 obj->mm.quirked = true;
284284 }
drivers/gpu/drm/i915/i915_pci.c+1−2
@@ -208,7 +208,7 @@ static const struct intel_device_info intel_ironlake_d_info = { · 207 unmodified lines
208208 static const struct intel_device_info intel_ironlake_m_info = {
209209 GEN5_FEATURES,
210210 .platform = INTEL_IRONLAKE,
211− .is_mobile = 1,
211+ .is_mobile = 1, .has_fbc = 1,
212212 };
213213
214214 #define GEN6_FEATURES \
@@ -390,7 +390,6 @@ static const struct intel_device_info intel_skylake_gt3_info = { · 175 unmodified lines
390390 .has_hw_contexts = 1, \
391391 .has_logical_ring_contexts = 1, \
392392 .has_guc = 1, \
393− .has_decoupled_mmio = 1, \
394393 .has_aliasing_ppgtt = 1, \
395394 .has_full_ppgtt = 1, \
396395 .has_full_48bit_ppgtt = 1, \
drivers/gpu/drm/i915/intel_display.c+9−0
@@ -12203,6 +12203,15 @@ static void update_scanline_offset(struct intel_crtc *crtc) · 12202 unmodified lines
1220312203 * type. For DP ports it behaves like most other platforms, but on HDMI
1220412204 * there's an extra 1 line difference. So we need to add two instead of
1220512205 * one to the value.
12206+ *
12207+ * On VLV/CHV DSI the scanline counter would appear to increment
12208+ * approx. 1/3 of a scanline before start of vblank. Unfortunately
12209+ * that means we can't tell whether we're in vblank or not while
12210+ * we're on that particular line. We must still set scanline_offset
12211+ * to 1 so that the vblank timestamps come out correct when we query
12212+ * the scanline counter from within the vblank interrupt handler.
12213+ * However if queried just before the start of vblank we'll get an
12214+ * answer that's slightly in the future.
1220612215 */
1220712216 if (IS_GEN2(dev_priv)) {
1220812217 const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
drivers/gpu/drm/i915/intel_engine_cs.c+17−3
@@ -1075,6 +1075,22 @@ int intel_ring_workarounds_emit(struct drm_i915_gem_request *req) · 1074 unmodified lines
10751075 return 0;
10761076 }
10771077
1078+static bool ring_is_idle(struct intel_engine_cs *engine)
1079+{
1080+ struct drm_i915_private *dev_priv = engine->i915;
1081+ bool idle = true;
1082+
1083+ intel_runtime_pm_get(dev_priv);
1084+
1085+ /* No bit for gen2, so assume the CS parser is idle */
1086+ if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE))
1087+ idle = false;
1088+
1089+ intel_runtime_pm_put(dev_priv);
1090+
1091+ return idle;
1092+}
1093+
10781094 /**
10791095 * intel_engine_is_idle() - Report if the engine has finished process all work
10801096 * @engine: the intel_engine_cs
@@ -1084,8 +1100,6 @@ int intel_ring_workarounds_emit(struct drm_i915_gem_request *req) · 3 unmodified lines
10841100 */
10851101 bool intel_engine_is_idle(struct intel_engine_cs *engine)
10861102 {
1087− struct drm_i915_private *dev_priv = engine->i915;
1088−
10891103 /* Any inflight/incomplete requests? */
10901104 if (!i915_seqno_passed(intel_engine_get_seqno(engine),
10911105 intel_engine_last_submit(engine)))
@@ -1100,7 +1114,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine) · 8 unmodified lines
11001114 return false;
11011115
11021116 /* Ring stopped? */
1103− if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE))
1117+ if (!ring_is_idle(engine))
11041118 return false;
11051119
11061120 return true;
drivers/gpu/drm/i915/intel_fbc.c+7−12
@@ -82,20 +82,10 @@ static unsigned int get_crtc_fence_y_offset(struct intel_crtc *crtc) · 81 unmodified lines
8282 static void intel_fbc_get_plane_source_size(struct intel_fbc_state_cache *cache,
8383 int *width, int *height)
8484 {
85− int w, h;
86−
87− if (drm_rotation_90_or_270(cache->plane.rotation)) {
88− w = cache->plane.src_h;
89− h = cache->plane.src_w;
90− } else {
91− w = cache->plane.src_w;
92− h = cache->plane.src_h;
93− }
94−
9585 if (width)
96− *width = w;
86+ *width = cache->plane.src_w;
9787 if (height)
98− *height = h;
88+ *height = cache->plane.src_h;
9989 }
10090
10191 static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
@@ -746,6 +736,11 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 644 unmodified lines
746736 cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate;
747737
748738 cache->plane.rotation = plane_state->base.rotation;
739+ /*
740+ * Src coordinates are already rotated by 270 degrees for
741+ * the 90/270 degree plane rotation cases (to match the
742+ * GTT mapping), hence no need to account for rotation here.
743+ */
749744 cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16;
750745 cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16;
751746 cache->plane.visible = plane_state->base.visible;
drivers/gpu/drm/i915/intel_pm.c+9−0
@@ -4335,10 +4335,18 @@ skl_compute_wm(struct drm_atomic_state *state) · 4334 unmodified lines
43354335 struct drm_crtc_state *cstate;
43364336 struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
43374337 struct skl_wm_values *results = &intel_state->wm_results;
4338+ struct drm_device *dev = state->dev;
43384339 struct skl_pipe_wm *pipe_wm;
43394340 bool changed = false;
43404341 int ret, i;
43414342
4343+ /*
4344+ * When we distrust bios wm we always need to recompute to set the
4345+ * expected DDB allocations for each CRTC.
4346+ */
4347+ if (to_i915(dev)->wm.distrust_bios_wm)
4348+ changed = true;
4349+
43424350 /*
43434351 * If this transaction isn't actually touching any CRTC's, don't
43444352 * bother with watermark calculation. Note that if we pass this
@@ -4349,6 +4357,7 @@ skl_compute_wm(struct drm_atomic_state *state) · 4 unmodified lines
43494357 */
43504358 for_each_new_crtc_in_state(state, crtc, cstate, i)
43514359 changed = true;
4360+
43524361 if (!changed)
43534362 return 0;
43544363
drivers/gpu/drm/i915/intel_psr.c+3−2
@@ -435,8 +435,9 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · 434 unmodified lines
435435 }
436436
437437 /* PSR2 is restricted to work with panel resolutions upto 3200x2000 */
438− if (intel_crtc->config->pipe_src_w > 3200 ||
439− intel_crtc->config->pipe_src_h > 2000) {
438+ if (dev_priv->psr.psr2_support &&
439+ (intel_crtc->config->pipe_src_w > 3200 ||
440+ intel_crtc->config->pipe_src_h > 2000)) {
440441 dev_priv->psr.psr2_support = false;
441442 return false;
442443 }
drivers/gpu/drm/i915/intel_sprite.c+21−0
@@ -83,10 +83,13 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, · 82 unmodified lines
8383 */
8484 void intel_pipe_update_start(struct intel_crtc *crtc)
8585 {
86+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
8687 const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
8788 long timeout = msecs_to_jiffies_timeout(1);
8889 int scanline, min, max, vblank_start;
8990 wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
91+ bool need_vlv_dsi_wa = (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
92+ intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DSI);
9093 DEFINE_WAIT(wait);
9194
9295 vblank_start = adjusted_mode->crtc_vblank_start;
@@ -139,6 +142,24 @@ void intel_pipe_update_start(struct intel_crtc *crtc) · 46 unmodified lines
139142
140143 drm_crtc_vblank_put(&crtc->base);
141144
145+ /*
146+ * On VLV/CHV DSI the scanline counter would appear to
147+ * increment approx. 1/3 of a scanline before start of vblank.
148+ * The registers still get latched at start of vblank however.
149+ * This means we must not write any registers on the first
150+ * line of vblank (since not the whole line is actually in
151+ * vblank). And unfortunately we can't use the interrupt to
152+ * wait here since it will fire too soon. We could use the
153+ * frame start interrupt instead since it will fire after the
154+ * critical scanline, but that would require more changes
155+ * in the interrupt code. So for now we'll just do the nasty
156+ * thing and poll for the bad scanline to pass us by.
157+ *
158+ * FIXME figure out if BXT+ DSI suffers from this as well
159+ */
160+ while (need_vlv_dsi_wa && scanline == vblank_start)
161+ scanline = intel_get_crtc_scanline(crtc);
162+
142163 crtc->debug.scanline_start = scanline;
143164 crtc->debug.start_vbl_time = ktime_get();
144165 crtc->debug.start_vbl_count = intel_crtc_get_vblank_counter(crtc);
drivers/gpu/drm/i915/intel_uc.h+0−2
@@ -59,8 +59,6 @@ struct drm_i915_gem_request; · 58 unmodified lines
5959 * available in the work queue (note, the queue is shared,
6060 * not per-engine). It is OK for this to be nonzero, but
6161 * it should not be huge!
62− * q_fail: failed to enqueue a work item. This should never happen,
63− * because we check for space beforehand.
6462 * b_fail: failed to ring the doorbell. This should never happen, unless
6563 * somehow the hardware misbehaves, or maybe if the GuC firmware
6664 * crashes? We probably need to reset the GPU to recover.
drivers/gpu/drm/imx/imx-ldb.c+1−1
@@ -673,7 +673,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) · 672 unmodified lines
673673 ret = drm_of_find_panel_or_bridge(child,
674674 imx_ldb->lvds_mux ? 4 : 2, 0,
675675 &channel->panel, &channel->bridge);
676− if (ret)
676+ if (ret && ret != -ENODEV)
677677 return ret;
678678
679679 /* panel ddc only if there is no bridge */
drivers/gpu/drm/mediatek/mtk_dsi.c+6−9
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <drm/drm_of.h>
2020 #include <linux/clk.h>
2121 #include <linux/component.h>
22+#include <linux/iopoll.h>
2223 #include <linux/irq.h>
2324 #include <linux/of.h>
2425 #include <linux/of_platform.h>
@@ -900,16 +901,12 @@ static int mtk_dsi_host_detach(struct mipi_dsi_host *host, · 875 unmodified lines
900901
901902 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi)
902903 {
903− u32 timeout_ms = 500000; /* total 1s ~ 2s timeout */
904−
905− while (timeout_ms--) {
906− if (!(readl(dsi->regs + DSI_INTSTA) & DSI_BUSY))
907− break;
908−
909− usleep_range(2, 4);
910− }
904+ int ret;
905+ u32 val;
911906
912− if (timeout_ms == 0) {
907+ ret = readl_poll_timeout(dsi->regs + DSI_INTSTA, val, !(val & DSI_BUSY),
908+ 4, 2000000);
909+ if (ret) {
913910 DRM_WARN("polling dsi wait not busy timeout!\n");
914911
915912 mtk_dsi_enable(dsi);
drivers/gpu/drm/mediatek/mtk_hdmi.c+1−1
@@ -1062,7 +1062,7 @@ static int mtk_hdmi_setup_vendor_specific_infoframe(struct mtk_hdmi *hdmi, · 1061 unmodified lines
10621062 }
10631063
10641064 err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer));
1065− if (err) {
1065+ if (err < 0) {
10661066 dev_err(hdmi->dev, "Failed to pack vendor infoframe: %zd\n",
10671067 err);
10681068 return err;
drivers/gpu/drm/meson/meson_drv.c+15−5
@@ -152,7 +152,7 @@ static struct regmap_config meson_regmap_config = { · 151 unmodified lines
152152 .max_register = 0x1000,
153153 };
154154
155−static int meson_drv_bind(struct device *dev)
155+static int meson_drv_bind_master(struct device *dev, bool has_components)
156156 {
157157 struct platform_device *pdev = to_platform_device(dev);
158158 struct meson_drm *priv;
@@ -233,10 +233,12 @@ static int meson_drv_bind(struct device *dev) · 74 unmodified lines
233233 if (ret)
234234 goto free_drm;
235235
236− ret = component_bind_all(drm->dev, drm);
237− if (ret) {
238− dev_err(drm->dev, "Couldn't bind all components\n");
239− goto free_drm;
236+ if (has_components) {
237+ ret = component_bind_all(drm->dev, drm);
238+ if (ret) {
239+ dev_err(drm->dev, "Couldn't bind all components\n");
240+ goto free_drm;
241+ }
240242 }
241243
242244 ret = meson_plane_create(priv);
@@ -276,6 +278,11 @@ free_drm: · 33 unmodified lines
276278 return ret;
277279 }
278280
281+static int meson_drv_bind(struct device *dev)
282+{
283+ return meson_drv_bind_master(dev, true);
284+}
285+
279286 static void meson_drv_unbind(struct device *dev)
280287 {
281288 struct drm_device *drm = dev_get_drvdata(dev);
@@ -357,6 +364,9 @@ static int meson_drv_probe(struct platform_device *pdev) · 75 unmodified lines
357364 count += meson_probe_remote(pdev, &match, np, remote);
358365 }
359366
367+ if (count && !match)
368+ return meson_drv_bind_master(&pdev->dev, false);
369+
360370 /* If some endpoints were found, initialize the nodes */
361371 if (count) {
362372 dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count);
drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 struct nvkm_alarm {
66 struct list_head head;
7+ struct list_head exec;
78 u64 timestamp;
89 void (*func)(struct nvkm_alarm *);
910 };
drivers/gpu/drm/nouveau/nouveau_drm.c+17−21
@@ -80,7 +80,7 @@ int nouveau_modeset = -1; · 79 unmodified lines
8080 module_param_named(modeset, nouveau_modeset, int, 0400);
8181
8282 MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)");
83−int nouveau_runtime_pm = -1;
83+static int nouveau_runtime_pm = -1;
8484 module_param_named(runpm, nouveau_runtime_pm, int, 0400);
8585
8686 static struct drm_driver driver_stub;
@@ -495,7 +495,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) · 408 unmodified lines
495495 nouveau_fbcon_init(dev);
496496 nouveau_led_init(dev);
497497
498− if (nouveau_runtime_pm != 0) {
498+ if (nouveau_pmops_runtime()) {
499499 pm_runtime_use_autosuspend(dev->dev);
500500 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
501501 pm_runtime_set_active(dev->dev);
@@ -527,7 +527,7 @@ nouveau_drm_unload(struct drm_device *dev) · 25 unmodified lines
527527 {
528528 struct nouveau_drm *drm = nouveau_drm(dev);
529529
530− if (nouveau_runtime_pm != 0) {
530+ if (nouveau_pmops_runtime()) {
531531 pm_runtime_get_sync(dev->dev);
532532 pm_runtime_forbid(dev->dev);
533533 }
@@ -726,6 +726,14 @@ nouveau_pmops_thaw(struct device *dev) · 192 unmodified lines
726726 return nouveau_do_resume(drm_dev, false);
727727 }
728728
729+bool
730+nouveau_pmops_runtime()
731+{
732+ if (nouveau_runtime_pm == -1)
733+ return nouveau_is_optimus() || nouveau_is_v1_dsm();
734+ return nouveau_runtime_pm == 1;
735+}
736+
729737 static int
730738 nouveau_pmops_runtime_suspend(struct device *dev)
731739 {
@@ -733,14 +741,7 @@ nouveau_pmops_runtime_suspend(struct device *dev) · 1 unmodified line
733741 struct drm_device *drm_dev = pci_get_drvdata(pdev);
734742 int ret;
735743
736− if (nouveau_runtime_pm == 0) {
737− pm_runtime_forbid(dev);
738− return -EBUSY;
739− }
740−
741− /* are we optimus enabled? */
742− if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
743− DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
744+ if (!nouveau_pmops_runtime()) {
744745 pm_runtime_forbid(dev);
745746 return -EBUSY;
746747 }
@@ -765,8 +766,10 @@ nouveau_pmops_runtime_resume(struct device *dev) · 18 unmodified lines
765766 struct nvif_device *device = &nouveau_drm(drm_dev)->client.device;
766767 int ret;
767768
768− if (nouveau_runtime_pm == 0)
769− return -EINVAL;
769+ if (!nouveau_pmops_runtime()) {
770+ pm_runtime_forbid(dev);
771+ return -EBUSY;
772+ }
770773
771774 pci_set_power_state(pdev, PCI_D0);
772775 pci_restore_state(pdev);
@@ -796,14 +799,7 @@ nouveau_pmops_runtime_idle(struct device *dev) · 23 unmodified lines
796799 struct nouveau_drm *drm = nouveau_drm(drm_dev);
797800 struct drm_crtc *crtc;
798801
799− if (nouveau_runtime_pm == 0) {
800− pm_runtime_forbid(dev);
801− return -EBUSY;
802− }
803−
804− /* are we optimus enabled? */
805− if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
806− DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
802+ if (!nouveau_pmops_runtime()) {
807803 pm_runtime_forbid(dev);
808804 return -EBUSY;
809805 }
drivers/gpu/drm/nouveau/nouveau_drv.h+1−2
@@ -108,8 +108,6 @@ nouveau_cli(struct drm_file *fpriv) · 107 unmodified lines
108108 #include <nvif/object.h>
109109 #include <nvif/device.h>
110110
111−extern int nouveau_runtime_pm;
112−
113111 struct nouveau_drm {
114112 struct nouveau_cli client;
115113 struct drm_device *dev;
@@ -195,6 +193,7 @@ nouveau_drm(struct drm_device *dev) · 79 unmodified lines
195193
196194 int nouveau_pmops_suspend(struct device *);
197195 int nouveau_pmops_resume(struct device *);
196+bool nouveau_pmops_runtime(void);
198197
199198 #include <nvkm/core/tegra.h>
200199
drivers/gpu/drm/nouveau/nouveau_vga.c+2−11
@@ -87,7 +87,7 @@ void · 86 unmodified lines
8787 nouveau_vga_init(struct nouveau_drm *drm)
8888 {
8989 struct drm_device *dev = drm->dev;
90− bool runtime = false;
90+ bool runtime = nouveau_pmops_runtime();
9191
9292 /* only relevant for PCI devices */
9393 if (!dev->pdev)
@@ -99,10 +99,6 @@ nouveau_vga_init(struct nouveau_drm *drm) · 5 unmodified lines
9999 if (pci_is_thunderbolt_attached(dev->pdev))
100100 return;
101101
102− if (nouveau_runtime_pm == 1)
103− runtime = true;
104− if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
105− runtime = true;
106102 vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
107103
108104 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
@@ -113,18 +109,13 @@ void · 4 unmodified lines
113109 nouveau_vga_fini(struct nouveau_drm *drm)
114110 {
115111 struct drm_device *dev = drm->dev;
116− bool runtime = false;
112+ bool runtime = nouveau_pmops_runtime();
117113
118114 vga_client_register(dev->pdev, NULL, NULL, NULL);
119115
120116 if (pci_is_thunderbolt_attached(dev->pdev))
121117 return;
122118
123− if (nouveau_runtime_pm == 1)
124− runtime = true;
125− if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
126− runtime = true;
127−
128119 vga_switcheroo_unregister_client(dev->pdev);
129120 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
130121 vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
drivers/gpu/drm/nouveau/nv50_display.c+2−1
@@ -2107,7 +2107,8 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) · 2106 unmodified lines
21072107 asyc->set.dither = true;
21082108 }
21092109 } else {
2110− asyc->set.mask = ~0;
2110+ if (asyc)
2111+ asyc->set.mask = ~0;
21112112 asyh->set.mask = ~0;
21122113 }
21132114
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c+4−3
@@ -50,7 +50,8 @@ nvkm_timer_alarm_trigger(struct nvkm_timer *tmr) · 49 unmodified lines
5050 /* Move to completed list. We'll drop the lock before
5151 * executing the callback so it can reschedule itself.
5252 */
53− list_move_tail(&alarm->head, &exec);
53+ list_del_init(&alarm->head);
54+ list_add(&alarm->exec, &exec);
5455 }
5556
5657 /* Shut down interrupt if no more pending alarms. */
@@ -59,8 +60,8 @@ nvkm_timer_alarm_trigger(struct nvkm_timer *tmr) · 2 unmodified lines
5960 spin_unlock_irqrestore(&tmr->lock, flags);
6061
6162 /* Execute completed callbacks. */
62− list_for_each_entry_safe(alarm, atemp, &exec, head) {
63− list_del_init(&alarm->head);
63+ list_for_each_entry_safe(alarm, atemp, &exec, exec) {
64+ list_del(&alarm->exec);
6465 alarm->func(alarm);
6566 }
6667 }
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c+0−12
@@ -245,8 +245,6 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, · 244 unmodified lines
245245 struct drm_connector_state *conn_state)
246246 {
247247 struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
248− struct rockchip_dp_device *dp = to_dp(encoder);
249− int ret;
250248
251249 /*
252250 * The hardware IC designed that VOP must output the RGB10 video
@@ -258,16 +256,6 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, · 5 unmodified lines
258256
259257 s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
260258 s->output_type = DRM_MODE_CONNECTOR_eDP;
261− if (dp->data->chip_type == RK3399_EDP) {
262− /*
263− * For RK3399, VOP Lit must code the out mode to RGB888,
264− * VOP Big must code the out mode to RGB10.
265− */
266− ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node,
267− encoder);
268− if (ret > 0)
269− s->output_mode = ROCKCHIP_OUT_MODE_P888;
270− }
271259
272260 return 0;
273261 }
drivers/gpu/drm/rockchip/cdn-dp-core.c+2−7
@@ -615,7 +615,6 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) · 614 unmodified lines
615615 {
616616 struct cdn_dp_device *dp = encoder_to_dp(encoder);
617617 int ret, val;
618− struct rockchip_crtc_state *state;
619618
620619 ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder);
621620 if (ret < 0) {
@@ -625,14 +624,10 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) · 3 unmodified lines
625624
626625 DRM_DEV_DEBUG_KMS(dp->dev, "vop %s output to cdn-dp\n",
627626 (ret) ? "LIT" : "BIG");
628− state = to_rockchip_crtc_state(encoder->crtc->state);
629− if (ret) {
627+ if (ret)
630628 val = DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT << 16);
631− state->output_mode = ROCKCHIP_OUT_MODE_P888;
632− } else {
629+ else
633630 val = DP_SEL_VOP_LIT << 16;
634− state->output_mode = ROCKCHIP_OUT_MODE_AAAA;
635− }
636631
637632 ret = cdn_dp_grf_write(dp, GRF_SOC_CON9, val);
638633 if (ret)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c+8−0
@@ -875,6 +875,7 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, · 874 unmodified lines
875875 static void vop_crtc_enable(struct drm_crtc *crtc)
876876 {
877877 struct vop *vop = to_vop(crtc);
878+ const struct vop_data *vop_data = vop->data;
878879 struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state);
879880 struct drm_display_mode *adjusted_mode = &crtc->state->adjusted_mode;
880881 u16 hsync_len = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
@@ -967,6 +968,13 @@ static void vop_crtc_enable(struct drm_crtc *crtc) · 86 unmodified lines
967968 DRM_DEV_ERROR(vop->dev, "unsupported connector_type [%d]\n",
968969 s->output_type);
969970 }
971+
972+ /*
973+ * if vop is not support RGB10 output, need force RGB10 to RGB888.
974+ */
975+ if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA &&
976+ !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10))
977+ s->output_mode = ROCKCHIP_OUT_MODE_P888;
970978 VOP_CTRL_SET(vop, out_mode, s->output_mode);
971979
972980 VOP_CTRL_SET(vop, htotal_pw, (htotal << 16) | hsync_len);
drivers/gpu/drm/rockchip/rockchip_drm_vop.h+3−0
@@ -142,6 +142,9 @@ struct vop_data { · 141 unmodified lines
142142 const struct vop_intr *intr;
143143 const struct vop_win_data *win;
144144 unsigned int win_size;
145+
146+#define VOP_FEATURE_OUTPUT_RGB10 BIT(0)
147+ u64 feature;
145148 };
146149
147150 /* interrupt define */
drivers/gpu/drm/rockchip/rockchip_vop_reg.c+2−0
@@ -275,6 +275,7 @@ static const struct vop_intr rk3288_vop_intr = { · 274 unmodified lines
275275 static const struct vop_data rk3288_vop = {
276276 .init_table = rk3288_init_reg_table,
277277 .table_size = ARRAY_SIZE(rk3288_init_reg_table),
278+ .feature = VOP_FEATURE_OUTPUT_RGB10,
278279 .intr = &rk3288_vop_intr,
279280 .ctrl = &rk3288_ctrl_data,
280281 .win = rk3288_vop_win_data,
@@ -343,6 +344,7 @@ static const struct vop_reg_data rk3399_init_reg_table[] = { · 62 unmodified lines
343344 static const struct vop_data rk3399_vop_big = {
344345 .init_table = rk3399_init_reg_table,
345346 .table_size = ARRAY_SIZE(rk3399_init_reg_table),
347+ .feature = VOP_FEATURE_OUTPUT_RGB10,
346348 .intr = &rk3399_vop_intr,
347349 .ctrl = &rk3399_ctrl_data,
348350 /*
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+2−2
@@ -41,9 +41,9 @@ · 40 unmodified lines
4141 #include <drm/ttm/ttm_module.h>
4242 #include "vmwgfx_fence.h"
4343
44−#define VMWGFX_DRIVER_DATE "20170221"
44+#define VMWGFX_DRIVER_DATE "20170607"
4545 #define VMWGFX_DRIVER_MAJOR 2
46−#define VMWGFX_DRIVER_MINOR 12
46+#define VMWGFX_DRIVER_MINOR 13
4747 #define VMWGFX_DRIVER_PATCHLEVEL 0
4848 #define VMWGFX_FILE_PAGE_OFFSET 0x00100000
4949 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c+2−0
@@ -368,6 +368,8 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 367 unmodified lines
368368 return fifo_state->static_buffer;
369369 else {
370370 fifo_state->dynamic_buffer = vmalloc(bytes);
371+ if (!fifo_state->dynamic_buffer)
372+ goto out_err;
371373 return fifo_state->dynamic_buffer;
372374 }
373375 }
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+1−114
@@ -274,108 +274,6 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) · 273 unmodified lines
274274 }
275275
276276
277−
278−/**
279− * vmw_du_cursor_plane_update() - Update cursor image and location
280− *
281− * @plane: plane object to update
282− * @crtc: owning CRTC of @plane
283− * @fb: framebuffer to flip onto plane
284− * @crtc_x: x offset of plane on crtc
285− * @crtc_y: y offset of plane on crtc
286− * @crtc_w: width of plane rectangle on crtc
287− * @crtc_h: height of plane rectangle on crtc
288− * @src_x: Not used
289− * @src_y: Not used
290− * @src_w: Not used
291− * @src_h: Not used
292− *
293− *
294− * RETURNS:
295− * Zero on success, error code on failure
296− */
297−int vmw_du_cursor_plane_update(struct drm_plane *plane,
298− struct drm_crtc *crtc,
299− struct drm_framebuffer *fb,
300− int crtc_x, int crtc_y,
301− unsigned int crtc_w,
302− unsigned int crtc_h,
303− uint32_t src_x, uint32_t src_y,
304− uint32_t src_w, uint32_t src_h)
305−{
306− struct vmw_private *dev_priv = vmw_priv(crtc->dev);
307− struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
308− struct vmw_surface *surface = NULL;
309− struct vmw_dma_buffer *dmabuf = NULL;
310− s32 hotspot_x, hotspot_y;
311− int ret;
312−
313− hotspot_x = du->hotspot_x + fb->hot_x;
314− hotspot_y = du->hotspot_y + fb->hot_y;
315−
316− /* A lot of the code assumes this */
317− if (crtc_w != 64 || crtc_h != 64) {
318− ret = -EINVAL;
319− goto out;
320− }
321−
322− if (vmw_framebuffer_to_vfb(fb)->dmabuf)
323− dmabuf = vmw_framebuffer_to_vfbd(fb)->buffer;
324− else
325− surface = vmw_framebuffer_to_vfbs(fb)->surface;
326−
327− if (surface && !surface->snooper.image) {
328− DRM_ERROR("surface not suitable for cursor\n");
329− ret = -EINVAL;
330− goto out;
331− }
332−
333− /* setup new image */
334− ret = 0;
335− if (surface) {
336− /* vmw_user_surface_lookup takes one reference */
337− du->cursor_surface = surface;
338−
339− du->cursor_age = du->cursor_surface->snooper.age;
340−
341− ret = vmw_cursor_update_image(dev_priv, surface->snooper.image,
342− 64, 64, hotspot_x, hotspot_y);
343− } else if (dmabuf) {
344− /* vmw_user_surface_lookup takes one reference */
345− du->cursor_dmabuf = dmabuf;
346−
347− ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, crtc_w, crtc_h,
348− hotspot_x, hotspot_y);
349− } else {
350− vmw_cursor_update_position(dev_priv, false, 0, 0);
351− goto out;
352− }
353−
354− if (!ret) {
355− du->cursor_x = crtc_x + du->set_gui_x;
356− du->cursor_y = crtc_y + du->set_gui_y;
357−
358− vmw_cursor_update_position(dev_priv, true,
359− du->cursor_x + hotspot_x,
360− du->cursor_y + hotspot_y);
361− }
362−
363−out:
364− return ret;
365−}
366−
367−
368−int vmw_du_cursor_plane_disable(struct drm_plane *plane)
369−{
370− if (plane->fb) {
371− drm_framebuffer_unreference(plane->fb);
372− plane->fb = NULL;
373− }
374−
375− return -EINVAL;
376−}
377−
378−
379277 void vmw_du_cursor_plane_destroy(struct drm_plane *plane)
380278 {
381279 vmw_cursor_update_position(plane->dev->dev_private, false, 0, 0);
@@ -472,18 +370,6 @@ vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, · 90 unmodified lines
472370 }
473371
474372
475−void
476−vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane,
477− struct drm_plane_state *old_state)
478−{
479− struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
480− struct vmw_private *dev_priv = vmw_priv(crtc->dev);
481−
482− drm_atomic_set_fb_for_plane(plane->state, NULL);
483− vmw_cursor_update_position(dev_priv, false, 0, 0);
484−}
485−
486−
487373 void
488374 vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
489375 struct drm_plane_state *old_state)
@@ -1498,6 +1384,7 @@ vmw_kms_new_framebuffer(struct vmw_private *dev_priv, · 1008 unmodified lines
14981384 */
14991385 if (vmw_kms_srf_ok(dev_priv, mode_cmd->width, mode_cmd->height) &&
15001386 dmabuf && only_2d &&
1387+ mode_cmd->width > 64 && /* Don't create a proxy for cursor */
15011388 dev_priv->active_display_unit == vmw_du_screen_target) {
15021389 ret = vmw_create_dmabuf_proxy(dev_priv->dev, mode_cmd,
15031390 dmabuf, &surface);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h+0−15
@@ -256,10 +256,6 @@ int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, · 255 unmodified lines
256256 u16 *r, u16 *g, u16 *b,
257257 uint32_t size,
258258 struct drm_modeset_acquire_ctx *ctx);
259−int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
260− uint32_t handle, uint32_t width, uint32_t height,
261− int32_t hot_x, int32_t hot_y);
262−int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
263259 int vmw_du_connector_set_property(struct drm_connector *connector,
264260 struct drm_property *property,
265261 uint64_t val);
@@ -339,15 +335,6 @@ void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv, · 73 unmodified lines
339335 /* Universal Plane Helpers */
340336 void vmw_du_primary_plane_destroy(struct drm_plane *plane);
341337 void vmw_du_cursor_plane_destroy(struct drm_plane *plane);
342−int vmw_du_cursor_plane_disable(struct drm_plane *plane);
343−int vmw_du_cursor_plane_update(struct drm_plane *plane,
344− struct drm_crtc *crtc,
345− struct drm_framebuffer *fb,
346− int crtc_x, int crtc_y,
347− unsigned int crtc_w,
348− unsigned int crtc_h,
349− uint32_t src_x, uint32_t src_y,
350− uint32_t src_w, uint32_t src_h);
351338
352339 /* Atomic Helpers */
353340 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
@@ -356,8 +343,6 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, · 2 unmodified lines
356343 struct drm_plane_state *state);
357344 void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
358345 struct drm_plane_state *old_state);
359−void vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane,
360− struct drm_plane_state *old_state);
361346 int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane,
362347 struct drm_plane_state *new_state);
363348 void vmw_du_plane_cleanup_fb(struct drm_plane *plane,
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c+22−5
@@ -56,6 +56,8 @@ enum stdu_content_type { · 55 unmodified lines
5656 * @right: Right side of bounding box.
5757 * @top: Top side of bounding box.
5858 * @bottom: Bottom side of bounding box.
59+ * @fb_left: Left side of the framebuffer/content bounding box
60+ * @fb_top: Top of the framebuffer/content bounding box
5961 * @buf: DMA buffer when DMA-ing between buffer and screen targets.
6062 * @sid: Surface ID when copying between surface and screen targets.
6163 */
@@ -63,6 +65,7 @@ struct vmw_stdu_dirty { · 1 unmodified line
6365 struct vmw_kms_dirty base;
6466 SVGA3dTransferType transfer;
6567 s32 left, right, top, bottom;
68+ s32 fb_left, fb_top;
6669 u32 pitch;
6770 union {
6871 struct vmw_dma_buffer *buf;
@@ -647,7 +650,7 @@ static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) · 578 unmodified lines
647650 *
648651 * @dirty: The closure structure.
649652 *
650− * This function calculates the bounding box for all the incoming clips
653+ * This function calculates the bounding box for all the incoming clips.
651654 */
652655 static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty)
653656 {
@@ -656,11 +659,19 @@ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) · 2 unmodified lines
656659
657660 dirty->num_hits = 1;
658661
659− /* Calculate bounding box */
662+ /* Calculate destination bounding box */
660663 ddirty->left = min_t(s32, ddirty->left, dirty->unit_x1);
661664 ddirty->top = min_t(s32, ddirty->top, dirty->unit_y1);
662665 ddirty->right = max_t(s32, ddirty->right, dirty->unit_x2);
663666 ddirty->bottom = max_t(s32, ddirty->bottom, dirty->unit_y2);
667+
668+ /*
669+ * Calculate content bounding box. We only need the top-left
670+ * coordinate because width and height will be the same as the
671+ * destination bounding box above
672+ */
673+ ddirty->fb_left = min_t(s32, ddirty->fb_left, dirty->fb_x);
674+ ddirty->fb_top = min_t(s32, ddirty->fb_top, dirty->fb_y);
664675 }
665676
666677
@@ -697,11 +708,11 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) · 30 unmodified lines
697708 /* Assume we are blitting from Host (display_srf) to Guest (dmabuf) */
698709 src_pitch = stdu->display_srf->base_size.width * stdu->cpp;
699710 src = ttm_kmap_obj_virtual(&stdu->host_map, &not_used);
700− src += dirty->unit_y1 * src_pitch + dirty->unit_x1 * stdu->cpp;
711+ src += ddirty->top * src_pitch + ddirty->left * stdu->cpp;
701712
702713 dst_pitch = ddirty->pitch;
703714 dst = ttm_kmap_obj_virtual(&stdu->guest_map, &not_used);
704− dst += dirty->fb_y * dst_pitch + dirty->fb_x * stdu->cpp;
715+ dst += ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp;
705716
706717
707718 /* Figure out the real direction */
@@ -760,7 +771,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) · 52 unmodified lines
760771 }
761772
762773 out_cleanup:
763− ddirty->left = ddirty->top = S32_MAX;
774+ ddirty->left = ddirty->top = ddirty->fb_left = ddirty->fb_top = S32_MAX;
764775 ddirty->right = ddirty->bottom = S32_MIN;
765776 }
766777
@@ -812,6 +823,7 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, · 45 unmodified lines
812823 SVGA3D_READ_HOST_VRAM;
813824 ddirty.left = ddirty.top = S32_MAX;
814825 ddirty.right = ddirty.bottom = S32_MIN;
826+ ddirty.fb_left = ddirty.fb_top = S32_MAX;
815827 ddirty.pitch = vfb->base.pitches[0];
816828 ddirty.buf = buf;
817829 ddirty.base.fifo_commit = vmw_stdu_dmabuf_fifo_commit;
@@ -1355,6 +1367,11 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane, · 537 unmodified lines
13551367 DRM_ERROR("Failed to bind surface to STDU.\n");
13561368 else
13571369 crtc->primary->fb = plane->state->fb;
1370+
1371+ ret = vmw_stdu_update_st(dev_priv, stdu);
1372+
1373+ if (ret)
1374+ DRM_ERROR("Failed to update STDU.\n");
13581375 }
13591376
13601377
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+15−8
@@ -1274,11 +1274,14 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 1273 unmodified lines
12741274 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
12751275 int ret;
12761276 uint32_t size;
1277− uint32_t backup_handle;
1277+ uint32_t backup_handle = 0;
12781278
12791279 if (req->multisample_count != 0)
12801280 return -EINVAL;
12811281
1282+ if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS)
1283+ return -EINVAL;
1284+
12821285 if (unlikely(vmw_user_surface_size == 0))
12831286 vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) +
12841287 128;
@@ -1314,12 +1317,16 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 29 unmodified lines
13141317 ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle,
13151318 &res->backup,
13161319 &user_srf->backup_base);
1317− if (ret == 0 && res->backup->base.num_pages * PAGE_SIZE <
1318− res->backup_size) {
1319− DRM_ERROR("Surface backup buffer is too small.\n");
1320− vmw_dmabuf_unreference(&res->backup);
1321− ret = -EINVAL;
1322− goto out_unlock;
1320+ if (ret == 0) {
1321+ if (res->backup->base.num_pages * PAGE_SIZE <
1322+ res->backup_size) {
1323+ DRM_ERROR("Surface backup buffer is too small.\n");
1324+ vmw_dmabuf_unreference(&res->backup);
1325+ ret = -EINVAL;
1326+ goto out_unlock;
1327+ } else {
1328+ backup_handle = req->buffer_handle;
1329+ }
13231330 }
13241331 } else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer)
13251332 ret = vmw_user_dmabuf_alloc(dev_priv, tfile,
@@ -1491,7 +1498,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, · 165 unmodified lines
14911498 dev_priv->stdu_max_height);
14921499
14931500 if (size.width > max_width || size.height > max_height) {
1494− DRM_ERROR("%ux%u\n, exeeds max surface size %ux%u",
1501+ DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u",
14951502 size.width, size.height,
14961503 max_width, max_height);
14971504 return -EINVAL;
drivers/gpu/ipu-v3/ipu-common.c+8−7
@@ -725,15 +725,16 @@ void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi) · 724 unmodified lines
725725 spin_lock_irqsave(&ipu->lock, flags);
726726
727727 val = ipu_cm_read(ipu, IPU_CONF);
728− if (vdi) {
728+ if (vdi)
729729 val |= IPU_CONF_IC_INPUT;
730− } else {
730+ else
731731 val &= ~IPU_CONF_IC_INPUT;
732− if (csi_id == 1)
733− val |= IPU_CONF_CSI_SEL;
734− else
735− val &= ~IPU_CONF_CSI_SEL;
736− }
732+
733+ if (csi_id == 1)
734+ val |= IPU_CONF_CSI_SEL;
735+ else
736+ val &= ~IPU_CONF_CSI_SEL;
737+
737738 ipu_cm_write(ipu, val, IPU_CONF);
738739
739740 spin_unlock_irqrestore(&ipu->lock, flags);
drivers/gpu/ipu-v3/ipu-pre.c+5−8
@@ -131,8 +131,6 @@ int ipu_pre_get(struct ipu_pre *pre) · 130 unmodified lines
131131 if (pre->in_use)
132132 return -EBUSY;
133133
134− clk_prepare_enable(pre->clk_axi);
135−
136134 /* first get the engine out of reset and remove clock gating */
137135 writel(0, pre->regs + IPU_PRE_CTRL);
138136
@@ -149,12 +147,7 @@ int ipu_pre_get(struct ipu_pre *pre) · 10 unmodified lines
149147
150148 void ipu_pre_put(struct ipu_pre *pre)
151149 {
152− u32 val;
153−
154− val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE;
155− writel(val, pre->regs + IPU_PRE_CTRL);
156−
157− clk_disable_unprepare(pre->clk_axi);
150+ writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL);
158151
159152 pre->in_use = false;
160153 }
@@ -249,6 +242,8 @@ static int ipu_pre_probe(struct platform_device *pdev) · 88 unmodified lines
249242 if (!pre->buffer_virt)
250243 return -ENOMEM;
251244
245+ clk_prepare_enable(pre->clk_axi);
246+
252247 pre->dev = dev;
253248 platform_set_drvdata(pdev, pre);
254249 mutex_lock(&ipu_pre_list_mutex);
@@ -268,6 +263,8 @@ static int ipu_pre_remove(struct platform_device *pdev) · 13 unmodified lines
268263 available_pres--;
269264 mutex_unlock(&ipu_pre_list_mutex);
270265
266+ clk_disable_unprepare(pre->clk_axi);
267+
271268 if (pre->buffer_virt)
272269 gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt,
273270 IPU_PRE_MAX_WIDTH * IPU_PRE_NUM_SCANLINES * 4);
drivers/hid/hid-core.c+221−61
@@ -826,11 +826,35 @@ static int hid_scan_report(struct hid_device *hid) · 825 unmodified lines
826826 * hid-rmi should take care of them,
827827 * not hid-generic
828828 */
829− if (IS_ENABLED(CONFIG_HID_RMI))
830− hid->group = HID_GROUP_RMI;
829+ hid->group = HID_GROUP_RMI;
831830 break;
832831 }
833832
833+ /* fall back to generic driver in case specific driver doesn't exist */
834+ switch (hid->group) {
835+ case HID_GROUP_MULTITOUCH_WIN_8:
836+ /* fall-through */
837+ case HID_GROUP_MULTITOUCH:
838+ if (!IS_ENABLED(CONFIG_HID_MULTITOUCH))
839+ hid->group = HID_GROUP_GENERIC;
840+ break;
841+ case HID_GROUP_SENSOR_HUB:
842+ if (!IS_ENABLED(CONFIG_HID_SENSOR_HUB))
843+ hid->group = HID_GROUP_GENERIC;
844+ break;
845+ case HID_GROUP_RMI:
846+ if (!IS_ENABLED(CONFIG_HID_RMI))
847+ hid->group = HID_GROUP_GENERIC;
848+ break;
849+ case HID_GROUP_WACOM:
850+ if (!IS_ENABLED(CONFIG_HID_WACOM))
851+ hid->group = HID_GROUP_GENERIC;
852+ break;
853+ case HID_GROUP_LOGITECH_DJ_DEVICE:
854+ if (!IS_ENABLED(CONFIG_HID_LOGITECH_DJ))
855+ hid->group = HID_GROUP_GENERIC;
856+ break;
857+ }
834858 vfree(parser);
835859 return 0;
836860 }
@@ -1763,15 +1787,23 @@ EXPORT_SYMBOL_GPL(hid_disconnect); · 926 unmodified lines
17631787 * used as a driver. See hid_scan_report().
17641788 */
17651789 static const struct hid_device_id hid_have_special_driver[] = {
1790+#if IS_ENABLED(CONFIG_HID_A4TECH)
17661791 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
17671792 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
17681793 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
1794+#endif
1795+#if IS_ENABLED(CONFIG_HID_ACCUTOUCH)
1796+ { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
1797+#endif
1798+#if IS_ENABLED(CONFIG_HID_ACRUX)
17691799 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) },
17701800 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) },
1801+#endif
1802+#if IS_ENABLED(CONFIG_HID_ALPS)
17711803 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) },
1804+#endif
1805+#if IS_ENABLED(CONFIG_HID_APPLE)
17721806 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
1773− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) },
1774− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) },
17751807 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
17761808 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
17771809 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
@@ -1792,11 +1824,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 14 unmodified lines
17921824 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) },
17931825 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) },
17941826 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) },
1795− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
1796− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) },
1797− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) },
1798− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
1799− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) },
18001827 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) },
18011828 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) },
18021829 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) },
@@ -1851,62 +1878,100 @@ static const struct hid_device_id hid_have_special_driver[] = { · 48 unmodified lines
18511878 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
18521879 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
18531880 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1881+#endif
1882+#if IS_ENABLED(CONFIG_HID_APPLEIR)
1883+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
1884+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) },
1885+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) },
1886+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
1887+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) },
1888+#endif
1889+#if IS_ENABLED(CONFIG_HID_ASUS)
18541890 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) },
18551891 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) },
18561892 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
18571893 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
18581894 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) },
1895+#endif
1896+#if IS_ENABLED(CONFIG_HID_AUREAL)
18591897 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
1898+#endif
1899+#if IS_ENABLED(CONFIG_HID_BELKIN)
18601900 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1901+ { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1902+#endif
1903+#if IS_ENABLED(CONFIG_HID_BETOP_FF)
18611904 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
18621905 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
18631906 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
18641907 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
1865− { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
1866− { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
1908+#endif
1909+#if IS_ENABLED(CONFIG_HID_CHERRY)
18671910 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
18681911 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1912+#endif
1913+#if IS_ENABLED(CONFIG_HID_CHICONY)
18691914 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1870− { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
18711915 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
18721916 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
18731917 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
1918+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
1919+#endif
1920+#if IS_ENABLED(CONFIG_HID_CMEDIA)
1921+ { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) },
1922+#endif
1923+#if IS_ENABLED(CONFIG_HID_CORSAIR)
18741924 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) },
18751925 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
1876− { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
1926+#endif
1927+#if IS_ENABLED(CONFIG_HID_CP2112)
18771928 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) },
1929+#endif
1930+#if IS_ENABLED(CONFIG_HID_CYPRESS)
18781931 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
18791932 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
18801933 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) },
18811934 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) },
18821935 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1883− { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) },
1936+#endif
1937+#if IS_ENABLED(CONFIG_HID_DRAGONRISE)
18841938 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
18851939 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) },
1886−#if IS_ENABLED(CONFIG_HID_MAYFLASH)
1887− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) },
1888− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
1889− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
1890− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
18911940 #endif
1892− { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) },
1893− { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) },
1941+#if IS_ENABLED(CONFIG_HID_ELECOM)
18941942 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
18951943 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) },
18961944 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) },
1945+#endif
1946+#if IS_ENABLED(CONFIG_HID_ELO)
18971947 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) },
18981948 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) },
1899− { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
1949+#endif
1950+#if IS_ENABLED(CONFIG_HID_EMS_FF)
19001951 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
1952+#endif
1953+#if IS_ENABLED(CONFIG_HID_EZKEY)
19011954 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1902− { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1903− { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
1955+#endif
1956+#if IS_ENABLED(CONFIG_HID_GEMBIRD)
19041957 { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) },
1905− { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
1958+#endif
1959+#if IS_ENABLED(CONFIG_HID_GFRM)
1960+ { HID_BLUETOOTH_DEVICE(0x58, 0x2000) },
1961+ { HID_BLUETOOTH_DEVICE(0x471, 0x2210) },
1962+#endif
1963+#if IS_ENABLED(CONFIG_HID_GREENASIA)
19061964 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
1965+#endif
1966+#if IS_ENABLED(CONFIG_HID_GT683R)
1967+ { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
1968+#endif
1969+#if IS_ENABLED(CONFIG_HID_GYRATION)
19071970 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
19081971 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
19091972 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
1973+#endif
1974+#if IS_ENABLED(CONFIG_HID_HOLTEK)
19101975 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) },
19111976 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
19121977 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
@@ -1915,12 +1980,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines
19151980 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) },
19161981 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
19171982 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) },
1918− { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
1919− { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
1920− { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
1983+#endif
1984+#if IS_ENABLED(CONFIG_HID_ICADE)
19211985 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
1986+#endif
1987+#if IS_ENABLED(CONFIG_HID_KENSINGTON)
19221988 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
1989+#endif
1990+#if IS_ENABLED(CONFIG_HID_KEYTOUCH)
19231991 { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
1992+#endif
1993+#if IS_ENABLED(CONFIG_HID_KYE)
19241994 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
19251995 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) },
19261996 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
@@ -1930,21 +2000,29 @@ static const struct hid_device_id hid_have_special_driver[] = { · 3 unmodified lines
19302000 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) },
19312001 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) },
19322002 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) },
1933− { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
2003+#endif
2004+#if IS_ENABLED(CONFIG_HID_LCPOWER)
19342005 { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
2006+#endif
2007+#if IS_ENABLED(CONFIG_HID_LED)
2008+ { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) },
2009+ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) },
2010+ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) },
2011+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) },
2012+ { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) },
2013+ { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
2014+#endif
19352015 #if IS_ENABLED(CONFIG_HID_LENOVO)
19362016 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
19372017 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
19382018 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
19392019 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
19402020 #endif
1941− { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) },
2021+#if IS_ENABLED(CONFIG_HID_LOGITECH)
19422022 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
19432023 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
19442024 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
19452025 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) },
1946− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
1947− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) },
19482026 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
19492027 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
19502028 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
@@ -1957,7 +2035,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 6 unmodified lines
19572035 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
19582036 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
19592037 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) },
1960− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
19612038 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
19622039 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
19632040 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
@@ -1969,17 +2046,30 @@ static const struct hid_device_id hid_have_special_driver[] = { · 5 unmodified lines
19692046 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) },
19702047 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
19712048 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) },
1972−#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
1973− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) },
1974− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) },
1975−#endif
19762049 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) },
19772050 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
19782051 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) },
19792052 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) },
1980− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
1981− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
1982− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) },
2053+#endif
2054+#if IS_ENABLED(CONFIG_HID_LOGITECH_HIDPP)
2055+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) },
2056+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
2057+#endif
2058+#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
2059+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) },
2060+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) },
2061+#endif
2062+#if IS_ENABLED(CONFIG_HID_MAGICMOUSE)
2063+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) },
2064+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) },
2065+#endif
2066+#if IS_ENABLED(CONFIG_HID_MAYFLASH)
2067+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) },
2068+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
2069+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
2070+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
2071+#endif
2072+#if IS_ENABLED(CONFIG_HID_MICROSOFT)
19832073 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
19842074 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) },
19852075 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
@@ -1995,9 +2085,22 @@ static const struct hid_device_id hid_have_special_driver[] = { · 9 unmodified lines
19952085 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) },
19962086 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) },
19972087 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
2088+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
2089+#endif
2090+#if IS_ENABLED(CONFIG_HID_MONTEREY)
19982091 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
1999− { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
2092+#endif
2093+#if IS_ENABLED(CONFIG_HID_MULTITOUCH)
2094+ { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) },
2095+#endif
2096+#if IS_ENABLED(CONFIG_HID_WIIMOTE)
2097+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
2098+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
2099+#endif
2100+#if IS_ENABLED(CONFIG_HID_NTI)
20002101 { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) },
2102+#endif
2103+#if IS_ENABLED(CONFIG_HID_NTRIG)
20012104 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
20022105 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
20032106 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) },
@@ -2017,13 +2120,41 @@ static const struct hid_device_id hid_have_special_driver[] = { · 13 unmodified lines
20172120 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) },
20182121 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) },
20192122 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) },
2123+#endif
2124+#if IS_ENABLED(CONFIG_HID_ORTEK)
20202125 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
20212126 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
2127+ { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
2128+#endif
2129+#if IS_ENABLED(CONFIG_HID_PANTHERLORD)
2130+ { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
2131+ { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
2132+ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
2133+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
2134+#endif
2135+#if IS_ENABLED(CONFIG_HID_PENMOUNT)
20222136 { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
2137+#endif
2138+#if IS_ENABLED(CONFIG_HID_PETALYNX)
20232139 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
2140+#endif
2141+#if IS_ENABLED(CONFIG_HID_PICOLCD)
2142+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
2143+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
2144+#endif
2145+#if IS_ENABLED(CONFIG_HID_PLANTRONICS)
20242146 { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
2147+#endif
2148+#if IS_ENABLED(CONFIG_HID_PRIMAX)
20252149 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
2026− { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) },
2150+#endif
2151+#if IS_ENABLED(CONFIG_HID_PRODIKEYS)
2152+ { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
2153+#endif
2154+#if IS_ENABLED(CONFIG_HID_RMI)
2155+ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) },
2156+ { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) },
2157+#endif
20272158 #if IS_ENABLED(CONFIG_HID_ROCCAT)
20282159 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
20292160 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
@@ -2051,9 +2182,21 @@ static const struct hid_device_id hid_have_special_driver[] = { · 21 unmodified lines
20512182 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) },
20522183 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
20532184 #endif
2185+#if IS_ENABLED(CONFIG_HID_SAMSUNG)
20542186 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
20552187 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
2056− { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
2188+#endif
2189+#if IS_ENABLED(CONFIG_HID_SMARTJOYPLUS)
2190+ { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) },
2191+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
2192+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) },
2193+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) },
2194+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) },
2195+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) },
2196+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
2197+#endif
2198+#if IS_ENABLED(CONFIG_HID_SONY)
2199+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
20572200 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) },
20582201 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
20592202 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
@@ -2072,9 +2215,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 12 unmodified lines
20722215 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
20732216 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
20742217 { HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER) },
2218+#endif
2219+#if IS_ENABLED(CONFIG_HID_SPEEDLINK)
2220+ { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
2221+#endif
2222+#if IS_ENABLED(CONFIG_HID_STEELSERIES)
20752223 { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
2224+#endif
2225+#if IS_ENABLED(CONFIG_HID_SUNPLUS)
20762226 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
2077− { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
2227+#endif
2228+#if IS_ENABLED(CONFIG_HID_THRUSTMASTER)
20782229 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
20792230 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
20802231 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) },
@@ -2083,12 +2234,25 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines
20832234 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) },
20842235 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
20852236 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) },
2237+#endif
2238+#if IS_ENABLED(CONFIG_HID_TIVO)
20862239 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
20872240 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
20882241 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
2242+#endif
2243+#if IS_ENABLED(CONFIG_HID_TOPSEED)
2244+ { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
2245+ { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
2246+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
20892247 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
20902248 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
2249+#endif
2250+#if IS_ENABLED(CONFIG_HID_TWINHAN)
20912251 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
2252+#endif
2253+#if IS_ENABLED(CONFIG_HID_UCLOGIC)
2254+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
2255+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_HUION_TABLET) },
20922256 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
20932257 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
20942258 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
@@ -2096,20 +2260,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line
20962260 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) },
20972261 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) },
20982262 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) },
2099− { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) },
21002263 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_YIYNOVA_TABLET) },
21012264 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_81) },
21022265 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_45) },
21032266 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) },
2104− { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
21052267 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_EX07S) },
2106− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
2107− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) },
2108− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) },
2109− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) },
2110− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) },
2111− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
2112− { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) },
2268+ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
2269+#endif
2270+#if IS_ENABLED(CONFIG_HID_UDRAW_PS3)
2271+ { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) },
2272+#endif
2273+#if IS_ENABLED(CONFIG_HID_WALTOP)
21132274 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
21142275 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
21152276 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) },
@@ -2117,19 +2278,18 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line
21172278 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
21182279 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
21192280 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) },
2120− { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
2281+#endif
2282+#if IS_ENABLED(CONFIG_HID_XINMO)
21212283 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) },
21222284 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) },
2285+#endif
2286+#if IS_ENABLED(CONFIG_HID_ZEROPLUS)
21232287 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
21242288 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
2289+#endif
2290+#if IS_ENABLED(CONFIG_HID_ZYDACRON)
21252291 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
2126−
2127− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
2128− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
2129− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
2130− { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) },
2131− { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) },
2132− { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) },
2292+#endif
21332293 { }
21342294 };
21352295
drivers/hsi/clients/ssi_protocol.c+1−1
@@ -1066,7 +1066,7 @@ static void ssip_pn_setup(struct net_device *dev) · 1065 unmodified lines
10661066 dev->addr_len = 1;
10671067 dev->tx_queue_len = SSIP_TXQUEUE_LEN;
10681068
1069− dev->destructor = free_netdev;
1069+ dev->needs_free_netdev = true;
10701070 dev->header_ops = &phonet_header_ops;
10711071 }
10721072
drivers/iio/adc/bcm_iproc_adc.c+4−4
@@ -143,7 +143,7 @@ static void iproc_adc_reg_dump(struct iio_dev *indio_dev) · 142 unmodified lines
143143 iproc_adc_dbg_reg(dev, adc_priv, IPROC_SOFT_BYPASS_DATA);
144144 }
145145
146−static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
146+static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
147147 {
148148 u32 channel_intr_status;
149149 u32 intr_status;
@@ -167,7 +167,7 @@ static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) · 17 unmodified lines
167167 return IRQ_NONE;
168168 }
169169
170−static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
170+static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
171171 {
172172 irqreturn_t retval = IRQ_NONE;
173173 struct iproc_adc_priv *adc_priv;
@@ -181,7 +181,7 @@ static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) · 7 unmodified lines
181181 adc_priv = iio_priv(indio_dev);
182182
183183 regmap_read(adc_priv->regmap, IPROC_INTERRUPT_STATUS, &intr_status);
184− dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_thread(),INTRPT_STS:%x\n",
184+ dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_handler(),INTRPT_STS:%x\n",
185185 intr_status);
186186
187187 intr_channels = (intr_status & IPROC_ADC_INTR_MASK) >> IPROC_ADC_INTR;
@@ -566,8 +566,8 @@ static int iproc_adc_probe(struct platform_device *pdev) · 378 unmodified lines
566566 }
567567
568568 ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno,
569− iproc_adc_interrupt_thread,
570569 iproc_adc_interrupt_handler,
570+ iproc_adc_interrupt_thread,
571571 IRQF_SHARED, "iproc-adc", indio_dev);
572572 if (ret) {
573573 dev_err(&pdev->dev, "request_irq error %d\n", ret);
drivers/iio/adc/max9611.c+5−5
@@ -438,10 +438,10 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev, · 437 unmodified lines
438438 struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev));
439439 unsigned int i, r;
440440
441− i = max9611->shunt_resistor_uohm / 1000;
442− r = max9611->shunt_resistor_uohm % 1000;
441+ i = max9611->shunt_resistor_uohm / 1000000;
442+ r = max9611->shunt_resistor_uohm % 1000000;
443443
444− return sprintf(buf, "%u.%03u\n", i, r);
444+ return sprintf(buf, "%u.%06u\n", i, r);
445445 }
446446
447447 static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444,
@@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client, · 88 unmodified lines
536536 int ret;
537537
538538 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611));
539− if (IS_ERR(indio_dev))
540− return PTR_ERR(indio_dev);
539+ if (!indio_dev)
540+ return -ENOMEM;
541541
542542 i2c_set_clientdata(client, indio_dev);
543543
drivers/iio/adc/sun4i-gpadc-iio.c+24−14
@@ -105,6 +105,8 @@ struct sun4i_gpadc_iio { · 104 unmodified lines
105105 bool no_irq;
106106 /* prevents concurrent reads of temperature and ADC */
107107 struct mutex mutex;
108+ struct thermal_zone_device *tzd;
109+ struct device *sensor_device;
108110 };
109111
110112 #define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \
@@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 391 unmodified lines
502504 {
503505 struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
504506 const struct of_device_id *of_dev;
505− struct thermal_zone_device *tzd;
506507 struct resource *mem;
507508 void __iomem *base;
508509 int ret;
@@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 23 unmodified lines
532533 if (!IS_ENABLED(CONFIG_THERMAL_OF))
533534 return 0;
534535
535− tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, info,
536− &sun4i_ts_tz_ops);
537− if (IS_ERR(tzd))
536+ info->sensor_device = &pdev->dev;
537+ info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0,
538+ info, &sun4i_ts_tz_ops);
539+ if (IS_ERR(info->tzd))
538540 dev_err(&pdev->dev, "could not register thermal sensor: %ld\n",
539− PTR_ERR(tzd));
541+ PTR_ERR(info->tzd));
540542
541− return PTR_ERR_OR_ZERO(tzd);
543+ return PTR_ERR_OR_ZERO(info->tzd);
542544 }
543545
544546 static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
@@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, · 39 unmodified lines
584586 * of_node, and the device from this driver as third argument to
585587 * return the temperature.
586588 */
587− struct thermal_zone_device *tzd;
588− tzd = devm_thermal_zone_of_sensor_register(pdev->dev.parent, 0,
589− info,
590− &sun4i_ts_tz_ops);
591− if (IS_ERR(tzd)) {
589+ info->sensor_device = pdev->dev.parent;
590+ info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
591+ 0, info,
592+ &sun4i_ts_tz_ops);
593+ if (IS_ERR(info->tzd)) {
592594 dev_err(&pdev->dev,
593595 "could not register thermal sensor: %ld\n",
594− PTR_ERR(tzd));
595− return PTR_ERR(tzd);
596+ PTR_ERR(info->tzd));
597+ return PTR_ERR(info->tzd);
596598 }
597599 } else {
598600 indio_dev->num_channels =
@@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) · 89 unmodified lines
688690
689691 pm_runtime_put(&pdev->dev);
690692 pm_runtime_disable(&pdev->dev);
691− if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF))
693+
694+ if (!IS_ENABLED(CONFIG_THERMAL_OF))
695+ return 0;
696+
697+ thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd);
698+
699+ if (!info->no_irq)
692700 iio_map_array_unregister(indio_dev);
693701
694702 return 0;
@@ -700,6 +708,7 @@ static const struct platform_device_id sun4i_gpadc_id[] = { · 5 unmodified lines
700708 { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data },
701709 { /* sentinel */ },
702710 };
711+MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id);
703712
704713 static struct platform_driver sun4i_gpadc_driver = {
705714 .driver = {
@@ -711,6 +720,7 @@ static struct platform_driver sun4i_gpadc_driver = { · 5 unmodified lines
711720 .probe = sun4i_gpadc_probe,
712721 .remove = sun4i_gpadc_remove,
713722 };
723+MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
714724
715725 module_platform_driver(sun4i_gpadc_driver);
716726
drivers/iio/adc/ti_am335x_adc.c+1−1
@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev) · 613 unmodified lines
614614 return -EINVAL;
615615 }
616616
617− indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev));
617+ indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev));
618618 if (indio_dev == NULL) {
619619 dev_err(&pdev->dev, "failed to allocate iio device\n");
620620 return -ENOMEM;
drivers/iio/industrialio-trigger.c+2−1
@@ -451,7 +451,8 @@ static ssize_t iio_trigger_write_current(struct device *dev, · 450 unmodified lines
451451 return len;
452452
453453 out_trigger_put:
454− iio_trigger_put(trig);
454+ if (trig)
455+ iio_trigger_put(trig);
455456 return ret;
456457 }
457458
drivers/iio/light/ltr501.c+2−2
@@ -74,9 +74,9 @@ static const int int_time_mapping[] = {100000, 50000, 200000, 400000}; · 73 unmodified lines
7474 static const struct reg_field reg_field_it =
7575 REG_FIELD(LTR501_ALS_MEAS_RATE, 3, 4);
7676 static const struct reg_field reg_field_als_intr =
77− REG_FIELD(LTR501_INTR, 0, 0);
78−static const struct reg_field reg_field_ps_intr =
7977 REG_FIELD(LTR501_INTR, 1, 1);
78+static const struct reg_field reg_field_ps_intr =
79+ REG_FIELD(LTR501_INTR, 0, 0);
8080 static const struct reg_field reg_field_als_rate =
8181 REG_FIELD(LTR501_ALS_MEAS_RATE, 0, 2);
8282 static const struct reg_field reg_field_ps_rate =
drivers/iio/proximity/as3935.c+6−8
@@ -40,9 +40,9 @@ · 39 unmodified lines
4040 #define AS3935_AFE_PWR_BIT BIT(0)
4141
4242 #define AS3935_INT 0x03
43−#define AS3935_INT_MASK 0x07
43+#define AS3935_INT_MASK 0x0f
4444 #define AS3935_EVENT_INT BIT(3)
45−#define AS3935_NOISE_INT BIT(1)
45+#define AS3935_NOISE_INT BIT(0)
4646
4747 #define AS3935_DATA 0x07
4848 #define AS3935_DATA_MASK 0x3F
@@ -215,7 +215,7 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) · 166 unmodified lines
215215
216216 st->buffer[0] = val & AS3935_DATA_MASK;
217217 iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
218− pf->timestamp);
218+ iio_get_time_ns(indio_dev));
219219 err_read:
220220 iio_trigger_notify_done(indio_dev->trig);
221221
@@ -244,7 +244,7 @@ static void as3935_event_work(struct work_struct *work) · 22 unmodified lines
244244
245245 switch (val) {
246246 case AS3935_EVENT_INT:
247− iio_trigger_poll(st->trig);
247+ iio_trigger_poll_chained(st->trig);
248248 break;
249249 case AS3935_NOISE_INT:
250250 dev_warn(&st->spi->dev, "noise level is too high\n");
@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) · 18 unmodified lines
269269
270270 static void calibrate_as3935(struct as3935_state *st)
271271 {
272− mutex_lock(&st->lock);
273−
274272 /* mask disturber interrupt bit */
275273 as3935_write(st, AS3935_INT, BIT(5));
276274
@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st) · 3 unmodified lines
280278
281279 mdelay(2);
282280 as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
283−
284− mutex_unlock(&st->lock);
285281 }
286282
287283 #ifdef CONFIG_PM_SLEEP
@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev) · 30 unmodified lines
318314 val &= ~AS3935_AFE_PWR_BIT;
319315 ret = as3935_write(st, AS3935_AFE_GAIN, val);
320316
317+ calibrate_as3935(st);
318+
321319 err_resume:
322320 mutex_unlock(&st->lock);
323321
drivers/infiniband/sw/rxe/rxe.h+4−1
@@ -68,6 +68,7 @@ · 67 unmodified lines
6868 static inline u32 rxe_crc32(struct rxe_dev *rxe,
6969 u32 crc, void *next, size_t len)
7070 {
71+ u32 retval;
7172 int err;
7273
7374 SHASH_DESC_ON_STACK(shash, rxe->tfm);
@@ -81,7 +82,9 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe, · 7 unmodified lines
8182 return crc32_le(crc, next, len);
8283 }
8384
84− return *(u32 *)shash_desc_ctx(shash);
85+ retval = *(u32 *)shash_desc_ctx(shash);
86+ barrier_data(shash_desc_ctx(shash));
87+ return retval;
8588 }
8689
8790 int rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);
drivers/input/mouse/elantech.c+16−0
@@ -1118,8 +1118,10 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 1117 unmodified lines
11181118 * Asus UX32VD 0x361f02 00, 15, 0e clickpad
11191119 * Avatar AVIU-145A2 0x361f00 ? clickpad
11201120 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
1121+ * Fujitsu LIFEBOOK E546 0x470f00 50, 12, 09 2 hw buttons
11211122 * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons
11221123 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
1124+ * Fujitsu LIFEBOOK E557 0x570f01 40, 14, 0c 2 hw buttons
11231125 * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
11241126 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
11251127 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
@@ -1524,6 +1526,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { · 398 unmodified lines
15241526 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"),
15251527 },
15261528 },
1529+ {
1530+ /* Fujitsu LIFEBOOK E546 does not work with crc_enabled == 0 */
1531+ .matches = {
1532+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1533+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E546"),
1534+ },
1535+ },
15271536 {
15281537 /* Fujitsu LIFEBOOK E547 does not work with crc_enabled == 0 */
15291538 .matches = {
@@ -1545,6 +1554,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { · 15 unmodified lines
15451554 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E556"),
15461555 },
15471556 },
1557+ {
1558+ /* Fujitsu LIFEBOOK E557 does not work with crc_enabled == 0 */
1559+ .matches = {
1560+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1561+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E557"),
1562+ },
1563+ },
15481564 {
15491565 /* Fujitsu LIFEBOOK U745 does not work with crc_enabled == 0 */
15501566 .matches = {
drivers/input/rmi4/rmi_f03.c+1−1
@@ -146,7 +146,7 @@ static int rmi_f03_register_pt(struct f03_data *f03) · 145 unmodified lines
146146 if (!serio)
147147 return -ENOMEM;
148148
149− serio->id.type = SERIO_8042;
149+ serio->id.type = SERIO_PS_PSTHRU;
150150 serio->write = rmi_f03_pt_write;
151151 serio->port_data = f03;
152152
drivers/iommu/of_iommu.c+7−0
@@ -118,6 +118,7 @@ static const struct iommu_ops · 117 unmodified lines
118118
119119 ops = iommu_ops_from_fwnode(fwnode);
120120 if ((ops && !ops->of_xlate) ||
121+ !of_device_is_available(iommu_spec->np) ||
121122 (!ops && !of_iommu_driver_present(iommu_spec->np)))
122123 return NULL;
123124
@@ -236,6 +237,12 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, · 112 unmodified lines
236237 ops = ERR_PTR(err);
237238 }
238239
240+ /* Ignore all other errors apart from EPROBE_DEFER */
241+ if (IS_ERR(ops) && (PTR_ERR(ops) != -EPROBE_DEFER)) {
242+ dev_dbg(dev, "Adding to IOMMU failed: %ld\n", PTR_ERR(ops));
243+ ops = NULL;
244+ }
245+
239246 return ops;
240247 }
241248
drivers/irqchip/irq-xtensa-mx.c+1−1
@@ -142,7 +142,7 @@ static struct irq_chip xtensa_mx_irq_chip = { · 141 unmodified lines
142142 int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent)
143143 {
144144 struct irq_domain *root_domain =
145− irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
145+ irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0,
146146 &xtensa_mx_irq_domain_ops,
147147 &xtensa_mx_irq_chip);
148148 irq_set_default_host(root_domain);
drivers/irqchip/irq-xtensa-pic.c+1−1
@@ -89,7 +89,7 @@ static struct irq_chip xtensa_irq_chip = { · 88 unmodified lines
8989 int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent)
9090 {
9191 struct irq_domain *root_domain =
92− irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
92+ irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0,
9393 &xtensa_irq_domain_ops, &xtensa_irq_chip);
9494 irq_set_default_host(root_domain);
9595 return 0;
drivers/md/md.c+12−4
@@ -5174,6 +5174,18 @@ static void mddev_delayed_delete(struct work_struct *ws) · 5173 unmodified lines
51745174
51755175 static void no_op(struct percpu_ref *r) {}
51765176
5177+int mddev_init_writes_pending(struct mddev *mddev)
5178+{
5179+ if (mddev->writes_pending.percpu_count_ptr)
5180+ return 0;
5181+ if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0)
5182+ return -ENOMEM;
5183+ /* We want to start with the refcount at zero */
5184+ percpu_ref_put(&mddev->writes_pending);
5185+ return 0;
5186+}
5187+EXPORT_SYMBOL_GPL(mddev_init_writes_pending);
5188+
51775189 static int md_alloc(dev_t dev, char *name)
51785190 {
51795191 /*
@@ -5239,10 +5251,6 @@ static int md_alloc(dev_t dev, char *name) · 59 unmodified lines
52395251 blk_queue_make_request(mddev->queue, md_make_request);
52405252 blk_set_stacking_limits(&mddev->queue->limits);
52415253
5242− if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0)
5243− goto abort;
5244− /* We want to start with the refcount at zero */
5245− percpu_ref_put(&mddev->writes_pending);
52465254 disk = alloc_disk(1 << shift);
52475255 if (!disk) {
52485256 blk_cleanup_queue(mddev->queue);
drivers/md/md.h+1−0
@@ -648,6 +648,7 @@ extern void md_unregister_thread(struct md_thread **threadp); · 647 unmodified lines
648648 extern void md_wakeup_thread(struct md_thread *thread);
649649 extern void md_check_recovery(struct mddev *mddev);
650650 extern void md_reap_sync_thread(struct mddev *mddev);
651+extern int mddev_init_writes_pending(struct mddev *mddev);
651652 extern void md_write_start(struct mddev *mddev, struct bio *bi);
652653 extern void md_write_inc(struct mddev *mddev, struct bio *bi);
653654 extern void md_write_end(struct mddev *mddev);
drivers/md/raid1.c+2−0
@@ -3063,6 +3063,8 @@ static int raid1_run(struct mddev *mddev) · 3062 unmodified lines
30633063 mdname(mddev));
30643064 return -EIO;
30653065 }
3066+ if (mddev_init_writes_pending(mddev) < 0)
3067+ return -ENOMEM;
30663068 /*
30673069 * copy the already verified devices into our private RAID1
30683070 * bookkeeping area. [whatever we allocate in run(),
drivers/md/raid10.c+3−0
@@ -3611,6 +3611,9 @@ static int raid10_run(struct mddev *mddev) · 3610 unmodified lines
36113611 int first = 1;
36123612 bool discard_supported = false;
36133613
3614+ if (mddev_init_writes_pending(mddev) < 0)
3615+ return -ENOMEM;
3616+
36143617 if (mddev->private == NULL) {
36153618 conf = setup_conf(mddev);
36163619 if (IS_ERR(conf))
drivers/md/raid5.c+3−0
@@ -7118,6 +7118,9 @@ static int raid5_run(struct mddev *mddev) · 7117 unmodified lines
71187118 long long min_offset_diff = 0;
71197119 int first = 1;
71207120
7121+ if (mddev_init_writes_pending(mddev) < 0)
7122+ return -ENOMEM;
7123+
71217124 if (mddev->recovery_cp != MaxSector)
71227125 pr_notice("md/raid:%s: not clean -- starting background reconstruction\n",
71237126 mdname(mddev));
drivers/media/cec/Kconfig+1−0
@@ -1,5 +1,6 @@
11 config MEDIA_CEC_RC
22 bool "HDMI CEC RC integration"
33 depends on CEC_CORE && RC_CORE
4+ depends on CEC_CORE=m || RC_CORE=y
45 ---help---
56 Pass on CEC remote control messages to the RC framework.
drivers/media/cec/cec-api.c+1−7
@@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, · 270 unmodified lines
271271 bool block, struct cec_msg __user *parg)
272272 {
273273 struct cec_msg msg = {};
274− long err = 0;
274+ long err;
275275
276276 if (copy_from_user(&msg, parg, sizeof(msg)))
277277 return -EFAULT;
278− mutex_lock(&adap->lock);
279− if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR)
280− err = -ENONET;
281− mutex_unlock(&adap->lock);
282− if (err)
283− return err;
284278
285279 err = cec_receive_msg(fh, &msg, block);
286280 if (err)
drivers/media/i2c/tc358743.c+1−1
@@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val) · 222 unmodified lines
223223 static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
224224 u8 mask, u8 val)
225225 {
226− i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
226+ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1);
227227 }
228228
229229 static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
drivers/media/rc/sir_ir.c+6−0
@@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) · 182 unmodified lines
183183 static unsigned long delt;
184184 unsigned long deltintr;
185185 unsigned long flags;
186+ int counter = 0;
186187 int iir, lsr;
187188
188189 while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) {
190+ if (++counter > 256) {
191+ dev_err(&sir_ir_dev->dev, "Trapped in interrupt");
192+ break;
193+ }
194+
189195 switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */
190196 case UART_IIR_MSI:
191197 (void)inb(io + UART_MSR);
drivers/media/usb/rainshadow-cec/rainshadow-cec.c+1−0
@@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) · 335 unmodified lines
336336 serio_set_drvdata(serio, rain);
337337 INIT_WORK(&rain->work, rain_irq_work_handler);
338338 mutex_init(&rain->write_lock);
339+ spin_lock_init(&rain->buf_lock);
339340
340341 err = serio_open(serio, drv);
341342 if (err)
drivers/media/v4l2-core/videobuf2-core.c+1−1
@@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs); · 867 unmodified lines
868868
869869 void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)
870870 {
871− if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv)
871+ if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)
872872 return NULL;
873873
874874 return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv);
drivers/memory/atmel-ebi.c+1−1
@@ -581,7 +581,7 @@ static int atmel_ebi_probe(struct platform_device *pdev) · 580 unmodified lines
581581 return of_platform_populate(np, NULL, NULL, dev);
582582 }
583583
584−static int atmel_ebi_resume(struct device *dev)
584+static __maybe_unused int atmel_ebi_resume(struct device *dev)
585585 {
586586 struct atmel_ebi *ebi = dev_get_drvdata(dev);
587587 struct atmel_ebi_dev *ebid;
drivers/misc/cxl/file.c+2−5
@@ -159,11 +159,8 @@ static long afu_ioctl_start_work(struct cxl_context *ctx, · 158 unmodified lines
159159
160160 /* Do this outside the status_mutex to avoid a circular dependency with
161161 * the locking in cxl_mmap_fault() */
162− if (copy_from_user(&work, uwork,
163− sizeof(struct cxl_ioctl_start_work))) {
164− rc = -EFAULT;
165− goto out;
166− }
162+ if (copy_from_user(&work, uwork, sizeof(work)))
163+ return -EFAULT;
167164
168165 mutex_lock(&ctx->status_mutex);
169166 if (ctx->status != OPENED) {
drivers/misc/cxl/native.c+11−3
@@ -1302,13 +1302,16 @@ int cxl_native_register_psl_err_irq(struct cxl *adapter) · 1301 unmodified lines
13021302
13031303 void cxl_native_release_psl_err_irq(struct cxl *adapter)
13041304 {
1305− if (adapter->native->err_virq != irq_find_mapping(NULL, adapter->native->err_hwirq))
1305+ if (adapter->native->err_virq == 0 ||
1306+ adapter->native->err_virq !=
1307+ irq_find_mapping(NULL, adapter->native->err_hwirq))
13061308 return;
13071309
13081310 cxl_p1_write(adapter, CXL_PSL_ErrIVTE, 0x0000000000000000);
13091311 cxl_unmap_irq(adapter->native->err_virq, adapter);
13101312 cxl_ops->release_one_irq(adapter, adapter->native->err_hwirq);
13111313 kfree(adapter->irq_name);
1314+ adapter->native->err_virq = 0;
13121315 }
13131316
13141317 int cxl_native_register_serr_irq(struct cxl_afu *afu)
@@ -1346,13 +1349,15 @@ int cxl_native_register_serr_irq(struct cxl_afu *afu) · 31 unmodified lines
13461349
13471350 void cxl_native_release_serr_irq(struct cxl_afu *afu)
13481351 {
1349− if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq))
1352+ if (afu->serr_virq == 0 ||
1353+ afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq))
13501354 return;
13511355
13521356 cxl_p1n_write(afu, CXL_PSL_SERR_An, 0x0000000000000000);
13531357 cxl_unmap_irq(afu->serr_virq, afu);
13541358 cxl_ops->release_one_irq(afu->adapter, afu->serr_hwirq);
13551359 kfree(afu->err_irq_name);
1360+ afu->serr_virq = 0;
13561361 }
13571362
13581363 int cxl_native_register_psl_irq(struct cxl_afu *afu)
@@ -1375,12 +1380,15 @@ int cxl_native_register_psl_irq(struct cxl_afu *afu) · 16 unmodified lines
13751380
13761381 void cxl_native_release_psl_irq(struct cxl_afu *afu)
13771382 {
1378− if (afu->native->psl_virq != irq_find_mapping(NULL, afu->native->psl_hwirq))
1383+ if (afu->native->psl_virq == 0 ||
1384+ afu->native->psl_virq !=
1385+ irq_find_mapping(NULL, afu->native->psl_hwirq))
13791386 return;
13801387
13811388 cxl_unmap_irq(afu->native->psl_virq, afu);
13821389 cxl_ops->release_one_irq(afu->adapter, afu->native->psl_hwirq);
13831390 kfree(afu->psl_irq_name);
1391+ afu->native->psl_virq = 0;
13841392 }
13851393
13861394 static void recover_psl_err(struct cxl_afu *afu, u64 errstat)
drivers/misc/mei/bus.c+3−1
@@ -763,8 +763,10 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, · 762 unmodified lines
763763 {
764764 struct mei_cl_device *cldev = to_mei_cl_device(dev);
765765 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
766+ u8 version = mei_me_cl_ver(cldev->me_cl);
766767
767− return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid);
768+ return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:%02X:",
769+ cldev->name, uuid, version);
768770 }
769771 static DEVICE_ATTR_RO(modalias);
770772
drivers/net/bonding/bond_3ad.c+27−0
@@ -90,10 +90,13 @@ enum ad_link_speed_type { · 89 unmodified lines
9090 AD_LINK_SPEED_100MBPS,
9191 AD_LINK_SPEED_1000MBPS,
9292 AD_LINK_SPEED_2500MBPS,
93+ AD_LINK_SPEED_5000MBPS,
9394 AD_LINK_SPEED_10000MBPS,
95+ AD_LINK_SPEED_14000MBPS,
9496 AD_LINK_SPEED_20000MBPS,
9597 AD_LINK_SPEED_25000MBPS,
9698 AD_LINK_SPEED_40000MBPS,
99+ AD_LINK_SPEED_50000MBPS,
97100 AD_LINK_SPEED_56000MBPS,
98101 AD_LINK_SPEED_100000MBPS,
99102 };
@@ -259,10 +262,13 @@ static inline int __check_agg_selection_timer(struct port *port) · 159 unmodified lines
259262 * %AD_LINK_SPEED_100MBPS,
260263 * %AD_LINK_SPEED_1000MBPS,
261264 * %AD_LINK_SPEED_2500MBPS,
265+ * %AD_LINK_SPEED_5000MBPS,
262266 * %AD_LINK_SPEED_10000MBPS
267+ * %AD_LINK_SPEED_14000MBPS,
263268 * %AD_LINK_SPEED_20000MBPS
264269 * %AD_LINK_SPEED_25000MBPS
265270 * %AD_LINK_SPEED_40000MBPS
271+ * %AD_LINK_SPEED_50000MBPS
266272 * %AD_LINK_SPEED_56000MBPS
267273 * %AD_LINK_SPEED_100000MBPS
268274 */
@@ -296,10 +302,18 @@ static u16 __get_link_speed(struct port *port) · 27 unmodified lines
296302 speed = AD_LINK_SPEED_2500MBPS;
297303 break;
298304
305+ case SPEED_5000:
306+ speed = AD_LINK_SPEED_5000MBPS;
307+ break;
308+
299309 case SPEED_10000:
300310 speed = AD_LINK_SPEED_10000MBPS;
301311 break;
302312
313+ case SPEED_14000:
314+ speed = AD_LINK_SPEED_14000MBPS;
315+ break;
316+
303317 case SPEED_20000:
304318 speed = AD_LINK_SPEED_20000MBPS;
305319 break;
@@ -312,6 +326,10 @@ static u16 __get_link_speed(struct port *port) · 6 unmodified lines
312326 speed = AD_LINK_SPEED_40000MBPS;
313327 break;
314328
329+ case SPEED_50000:
330+ speed = AD_LINK_SPEED_50000MBPS;
331+ break;
332+
315333 case SPEED_56000:
316334 speed = AD_LINK_SPEED_56000MBPS;
317335 break;
@@ -712,9 +730,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 394 unmodified lines
712730 case AD_LINK_SPEED_2500MBPS:
713731 bandwidth = nports * 2500;
714732 break;
733+ case AD_LINK_SPEED_5000MBPS:
734+ bandwidth = nports * 5000;
735+ break;
715736 case AD_LINK_SPEED_10000MBPS:
716737 bandwidth = nports * 10000;
717738 break;
739+ case AD_LINK_SPEED_14000MBPS:
740+ bandwidth = nports * 14000;
741+ break;
718742 case AD_LINK_SPEED_20000MBPS:
719743 bandwidth = nports * 20000;
720744 break;
@@ -724,6 +748,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 3 unmodified lines
724748 case AD_LINK_SPEED_40000MBPS:
725749 bandwidth = nports * 40000;
726750 break;
751+ case AD_LINK_SPEED_50000MBPS:
752+ bandwidth = nports * 50000;
753+ break;
727754 case AD_LINK_SPEED_56000MBPS:
728755 bandwidth = nports * 56000;
729756 break;
drivers/net/bonding/bond_main.c+3−3
@@ -4187,7 +4187,6 @@ static void bond_destructor(struct net_device *bond_dev) · 4186 unmodified lines
41874187 struct bonding *bond = netdev_priv(bond_dev);
41884188 if (bond->wq)
41894189 destroy_workqueue(bond->wq);
4190− free_netdev(bond_dev);
41914190 }
41924191
41934192 void bond_setup(struct net_device *bond_dev)
@@ -4207,7 +4206,8 @@ void bond_setup(struct net_device *bond_dev) · 13 unmodified lines
42074206 bond_dev->netdev_ops = &bond_netdev_ops;
42084207 bond_dev->ethtool_ops = &bond_ethtool_ops;
42094208
4210− bond_dev->destructor = bond_destructor;
4209+ bond_dev->needs_free_netdev = true;
4210+ bond_dev->priv_destructor = bond_destructor;
42114211
42124212 SET_NETDEV_DEVTYPE(bond_dev, &bond_type);
42134213
@@ -4731,7 +4731,7 @@ int bond_create(struct net *net, const char *name) · 517 unmodified lines
47314731
47324732 rtnl_unlock();
47334733 if (res < 0)
4734− bond_destructor(bond_dev);
4734+ free_netdev(bond_dev);
47354735 return res;
47364736 }
47374737
drivers/net/caif/caif_hsi.c+1−1
@@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_device *dev) · 1120 unmodified lines
11211121 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
11221122 dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ;
11231123 dev->priv_flags |= IFF_NO_QUEUE;
1124− dev->destructor = free_netdev;
1124+ dev->needs_free_netdev = true;
11251125 dev->netdev_ops = &cfhsi_netdevops;
11261126 for (i = 0; i < CFHSI_PRIO_LAST; ++i)
11271127 skb_queue_head_init(&cfhsi->qhead[i]);
drivers/net/caif/caif_serial.c+1−1
@@ -428,7 +428,7 @@ static void caifdev_setup(struct net_device *dev) · 427 unmodified lines
428428 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
429429 dev->mtu = CAIF_MAX_MTU;
430430 dev->priv_flags |= IFF_NO_QUEUE;
431− dev->destructor = free_netdev;
431+ dev->needs_free_netdev = true;
432432 skb_queue_head_init(&serdev->head);
433433 serdev->common.link_select = CAIF_LINK_LOW_LATENCY;
434434 serdev->common.use_frag = true;
drivers/net/caif/caif_spi.c+1−1
@@ -712,7 +712,7 @@ static void cfspi_setup(struct net_device *dev) · 711 unmodified lines
712712 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
713713 dev->priv_flags |= IFF_NO_QUEUE;
714714 dev->mtu = SPI_MAX_PAYLOAD_SIZE;
715− dev->destructor = free_netdev;
715+ dev->needs_free_netdev = true;
716716 skb_queue_head_init(&cfspi->qhead);
717717 skb_queue_head_init(&cfspi->chead);
718718 cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
drivers/net/caif/caif_virtio.c+1−1
@@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_device *netdev) · 616 unmodified lines
617617 netdev->tx_queue_len = 100;
618618 netdev->flags = IFF_POINTOPOINT | IFF_NOARP;
619619 netdev->mtu = CFV_DEF_MTU_SIZE;
620− netdev->destructor = free_netdev;
620+ netdev->needs_free_netdev = true;
621621 }
622622
623623 /* Create debugfs counters for the device */
drivers/net/can/dev.c+3−0
@@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 390 unmodified lines
391391 can_update_state_error_stats(dev, new_state);
392392 priv->state = new_state;
393393
394+ if (!cf)
395+ return;
396+
394397 if (unlikely(new_state == CAN_STATE_BUS_OFF)) {
395398 cf->can_id |= CAN_ERR_BUSOFF;
396399 return;
drivers/net/can/peak_canfd/peak_canfd.c+1−1
@@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, · 488 unmodified lines
489489 struct pucan_rx_msg *msg_list, int msg_count)
490490 {
491491 void *msg_ptr = msg_list;
492− int i, msg_size;
492+ int i, msg_size = 0;
493493
494494 for (i = 0; i < msg_count; i++) {
495495 msg_size = peak_canfd_handle_msg(priv, msg_ptr);
drivers/net/can/slcan.c+3−4
@@ -417,7 +417,7 @@ static int slc_open(struct net_device *dev) · 416 unmodified lines
417417 static void slc_free_netdev(struct net_device *dev)
418418 {
419419 int i = dev->base_addr;
420− free_netdev(dev);
420+
421421 slcan_devs[i] = NULL;
422422 }
423423
@@ -436,7 +436,8 @@ static const struct net_device_ops slc_netdev_ops = { · 12 unmodified lines
436436 static void slc_setup(struct net_device *dev)
437437 {
438438 dev->netdev_ops = &slc_netdev_ops;
439− dev->destructor = slc_free_netdev;
439+ dev->needs_free_netdev = true;
440+ dev->priv_destructor = slc_free_netdev;
440441
441442 dev->hard_header_len = 0;
442443 dev->addr_len = 0;
@@ -761,8 +762,6 @@ static void __exit slcan_exit(void) · 318 unmodified lines
761762 if (sl->tty) {
762763 printk(KERN_ERR "%s: tty discipline still running\n",
763764 dev->name);
764− /* Intentionally leak the control block. */
765− dev->destructor = NULL;
766765 }
767766
768767 unregister_netdev(dev);
drivers/net/can/usb/gs_usb.c+2−0
@@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) · 264 unmodified lines
265265 sizeof(*dm),
266266 1000);
267267
268+ kfree(dm);
269+
268270 return rc;
269271 }
270272
drivers/net/can/usb/peak_usb/pcan_usb_core.c+1−3
@@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, · 907 unmodified lines
908908 const struct peak_usb_adapter *peak_usb_adapter = NULL;
909909 int i, err = -ENOMEM;
910910
911− usb_dev = interface_to_usbdev(intf);
912−
913911 /* get corresponding PCAN-USB adapter */
914912 for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++)
915913 if (peak_usb_adapters_list[i]->device_id == usb_id_product) {
@@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, · 4 unmodified lines
920918 if (!peak_usb_adapter) {
921919 /* should never come except device_id bad usage in this file */
922920 pr_err("%s: didn't find device id. 0x%x in devices list\n",
923− PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct);
921+ PCAN_USB_DRIVER_NAME, usb_id_product);
924922 return -ENODEV;
925923 }
926924
drivers/net/can/vcan.c+2−2
@@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { · 151 unmodified lines
152152 static void vcan_setup(struct net_device *dev)
153153 {
154154 dev->type = ARPHRD_CAN;
155− dev->mtu = CAN_MTU;
155+ dev->mtu = CANFD_MTU;
156156 dev->hard_header_len = 0;
157157 dev->addr_len = 0;
158158 dev->tx_queue_len = 0;
@@ -163,7 +163,7 @@ static void vcan_setup(struct net_device *dev) · 4 unmodified lines
163163 dev->flags |= IFF_ECHO;
164164
165165 dev->netdev_ops = &vcan_netdev_ops;
166− dev->destructor = free_netdev;
166+ dev->needs_free_netdev = true;
167167 }
168168
169169 static struct rtnl_link_ops vcan_link_ops __read_mostly = {
drivers/net/can/vxcan.c+2−2
@@ -150,13 +150,13 @@ static const struct net_device_ops vxcan_netdev_ops = { · 149 unmodified lines
150150 static void vxcan_setup(struct net_device *dev)
151151 {
152152 dev->type = ARPHRD_CAN;
153− dev->mtu = CAN_MTU;
153+ dev->mtu = CANFD_MTU;
154154 dev->hard_header_len = 0;
155155 dev->addr_len = 0;
156156 dev->tx_queue_len = 0;
157157 dev->flags = (IFF_NOARP|IFF_ECHO);
158158 dev->netdev_ops = &vxcan_netdev_ops;
159− dev->destructor = free_netdev;
159+ dev->needs_free_netdev = true;
160160 }
161161
162162 /* forward declaration for rtnl_create_link() */
drivers/net/dummy.c+2−2
@@ -328,7 +328,6 @@ static void dummy_free_netdev(struct net_device *dev) · 327 unmodified lines
328328 struct dummy_priv *priv = netdev_priv(dev);
329329
330330 kfree(priv->vfinfo);
331− free_netdev(dev);
332331 }
333332
334333 static void dummy_setup(struct net_device *dev)
@@ -338,7 +337,8 @@ static void dummy_setup(struct net_device *dev) · 3 unmodified lines
338337 /* Initialize the device structure. */
339338 dev->netdev_ops = &dummy_netdev_ops;
340339 dev->ethtool_ops = &dummy_ethtool_ops;
341− dev->destructor = dummy_free_netdev;
340+ dev->needs_free_netdev = true;
341+ dev->priv_destructor = dummy_free_netdev;
342342
343343 /* Fill in device structure with ethernet-generic values. */
344344 dev->flags |= IFF_NOARP;
drivers/net/ethernet/amazon/ena/ena_com.c+21−14
@@ -61,6 +61,8 @@ · 60 unmodified lines
6161
6262 #define ENA_MMIO_READ_TIMEOUT 0xFFFFFFFF
6363
64+#define ENA_REGS_ADMIN_INTR_MASK 1
65+
6466 /*****************************************************************************/
6567 /*****************************************************************************/
6668 /*****************************************************************************/
@@ -232,11 +234,9 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu · 165 unmodified lines
232234 tail_masked = admin_queue->sq.tail & queue_size_mask;
233235
234236 /* In case of queue FULL */
235− cnt = admin_queue->sq.tail - admin_queue->sq.head;
237+ cnt = atomic_read(&admin_queue->outstanding_cmds);
236238 if (cnt >= admin_queue->q_depth) {
237− pr_debug("admin queue is FULL (tail %d head %d depth: %d)\n",
238− admin_queue->sq.tail, admin_queue->sq.head,
239− admin_queue->q_depth);
239+ pr_debug("admin queue is full.\n");
240240 admin_queue->stats.out_of_space++;
241241 return ERR_PTR(-ENOSPC);
242242 }
@@ -508,15 +508,20 @@ static int ena_com_comp_status_to_errno(u8 comp_status) · 265 unmodified lines
508508 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,
509509 struct ena_com_admin_queue *admin_queue)
510510 {
511− unsigned long flags;
512− u32 start_time;
511+ unsigned long flags, timeout;
513512 int ret;
514513
515− start_time = ((u32)jiffies_to_usecs(jiffies));
514+ timeout = jiffies + ADMIN_CMD_TIMEOUT_US;
515+
516+ while (1) {
517+ spin_lock_irqsave(&admin_queue->q_lock, flags);
518+ ena_com_handle_admin_completion(admin_queue);
519+ spin_unlock_irqrestore(&admin_queue->q_lock, flags);
520+
521+ if (comp_ctx->status != ENA_CMD_SUBMITTED)
522+ break;
516523
517− while (comp_ctx->status == ENA_CMD_SUBMITTED) {
518− if ((((u32)jiffies_to_usecs(jiffies)) - start_time) >
519− ADMIN_CMD_TIMEOUT_US) {
524+ if (time_is_before_jiffies(timeout)) {
520525 pr_err("Wait for completion (polling) timeout\n");
521526 /* ENA didn't have any completion */
522527 spin_lock_irqsave(&admin_queue->q_lock, flags);
@@ -528,10 +533,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 5 unmodified lines
528533 goto err;
529534 }
530535
531− spin_lock_irqsave(&admin_queue->q_lock, flags);
532− ena_com_handle_admin_completion(admin_queue);
533− spin_unlock_irqrestore(&admin_queue->q_lock, flags);
534−
535536 msleep(100);
536537 }
537538
@@ -1455,6 +1456,12 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) · 917 unmodified lines
14551456
14561457 void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling)
14571458 {
1459+ u32 mask_value = 0;
1460+
1461+ if (polling)
1462+ mask_value = ENA_REGS_ADMIN_INTR_MASK;
1463+
1464+ writel(mask_value, ena_dev->reg_bar + ENA_REGS_INTR_MASK_OFF);
14581465 ena_dev->admin_queue.polling = polling;
14591466 }
14601467
drivers/net/ethernet/amazon/ena/ena_ethtool.c+1−1
@@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 79 unmodified lines
8080 ENA_STAT_TX_ENTRY(tx_poll),
8181 ENA_STAT_TX_ENTRY(doorbells),
8282 ENA_STAT_TX_ENTRY(prepare_ctx_err),
83− ENA_STAT_TX_ENTRY(missing_tx_comp),
8483 ENA_STAT_TX_ENTRY(bad_req_id),
8584 };
8685
@@ -94,6 +93,7 @@ static const struct ena_stats ena_stats_rx_strings[] = { · 7 unmodified lines
9493 ENA_STAT_RX_ENTRY(dma_mapping_err),
9594 ENA_STAT_RX_ENTRY(bad_desc_num),
9695 ENA_STAT_RX_ENTRY(rx_copybreak_pkt),
96+ ENA_STAT_RX_ENTRY(empty_rx_ring),
9797 };
9898
9999 static const struct ena_stats ena_stats_ena_com_strings[] = {
drivers/net/ethernet/amazon/ena/ena_netdev.c+132−47
@@ -190,6 +190,7 @@ static void ena_init_io_rings(struct ena_adapter *adapter) · 189 unmodified lines
190190 rxr->sgl_size = adapter->max_rx_sgl_size;
191191 rxr->smoothed_interval =
192192 ena_com_get_nonadaptive_moderation_interval_rx(ena_dev);
193+ rxr->empty_rx_queue = 0;
193194 }
194195 }
195196
@@ -1078,6 +1079,26 @@ inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, · 882 unmodified lines
10781079 rx_ring->per_napi_bytes = 0;
10791080 }
10801081
1082+static inline void ena_unmask_interrupt(struct ena_ring *tx_ring,
1083+ struct ena_ring *rx_ring)
1084+{
1085+ struct ena_eth_io_intr_reg intr_reg;
1086+
1087+ /* Update intr register: rx intr delay,
1088+ * tx intr delay and interrupt unmask
1089+ */
1090+ ena_com_update_intr_reg(&intr_reg,
1091+ rx_ring->smoothed_interval,
1092+ tx_ring->smoothed_interval,
1093+ true);
1094+
1095+ /* It is a shared MSI-X.
1096+ * Tx and Rx CQ have pointer to it.
1097+ * So we use one of them to reach the intr reg
1098+ */
1099+ ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1100+}
1101+
10811102 static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring,
10821103 struct ena_ring *rx_ring)
10831104 {
@@ -1108,7 +1129,6 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 24 unmodified lines
11081129 {
11091130 struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi);
11101131 struct ena_ring *tx_ring, *rx_ring;
1111− struct ena_eth_io_intr_reg intr_reg;
11121132
11131133 u32 tx_work_done;
11141134 u32 rx_work_done;
@@ -1149,22 +1169,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 34 unmodified lines
11491169 if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev))
11501170 ena_adjust_intr_moderation(rx_ring, tx_ring);
11511171
1152− /* Update intr register: rx intr delay,
1153− * tx intr delay and interrupt unmask
1154− */
1155− ena_com_update_intr_reg(&intr_reg,
1156− rx_ring->smoothed_interval,
1157− tx_ring->smoothed_interval,
1158− true);
1159−
1160− /* It is a shared MSI-X.
1161− * Tx and Rx CQ have pointer to it.
1162− * So we use one of them to reach the intr reg
1163− */
1164− ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1172+ ena_unmask_interrupt(tx_ring, rx_ring);
11651173 }
11661174
1167−
11681175 ena_update_ring_numa_node(tx_ring, rx_ring);
11691176
11701177 ret = rx_work_done;
@@ -1485,6 +1492,11 @@ static int ena_up_complete(struct ena_adapter *adapter) · 314 unmodified lines
14851492
14861493 ena_napi_enable_all(adapter);
14871494
1495+ /* Enable completion queues interrupt */
1496+ for (i = 0; i < adapter->num_queues; i++)
1497+ ena_unmask_interrupt(&adapter->tx_ring[i],
1498+ &adapter->rx_ring[i]);
1499+
14881500 /* schedule napi in case we had pending packets
14891501 * from the last time we disable napi
14901502 */
@@ -1532,6 +1544,7 @@ static int ena_create_io_tx_queue(struct ena_adapter *adapter, int qid) · 41 unmodified lines
15321544 "Failed to get TX queue handlers. TX queue num %d rc: %d\n",
15331545 qid, rc);
15341546 ena_com_destroy_io_queue(ena_dev, ena_qid);
1547+ return rc;
15351548 }
15361549
15371550 ena_com_update_numa_node(tx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1596,6 +1609,7 @@ static int ena_create_io_rx_queue(struct ena_adapter *adapter, int qid) · 58 unmodified lines
15961609 "Failed to get RX queue handlers. RX queue num %d rc: %d\n",
15971610 qid, rc);
15981611 ena_com_destroy_io_queue(ena_dev, ena_qid);
1612+ return rc;
15991613 }
16001614
16011615 ena_com_update_numa_node(rx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1981,6 +1995,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 379 unmodified lines
19811995
19821996 tx_info->tx_descs = nb_hw_desc;
19831997 tx_info->last_jiffies = jiffies;
1998+ tx_info->print_once = 0;
19841999
19852000 tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use,
19862001 tx_ring->ring_size);
@@ -2550,13 +2565,44 @@ err: · 563 unmodified lines
25502565 "Reset attempt failed. Can not reset the device\n");
25512566 }
25522567
2553−static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2568+static int check_missing_comp_in_queue(struct ena_adapter *adapter,
2569+ struct ena_ring *tx_ring)
25542570 {
25552571 struct ena_tx_buffer *tx_buf;
25562572 unsigned long last_jiffies;
2573+ u32 missed_tx = 0;
2574+ int i;
2575+
2576+ for (i = 0; i < tx_ring->ring_size; i++) {
2577+ tx_buf = &tx_ring->tx_buffer_info[i];
2578+ last_jiffies = tx_buf->last_jiffies;
2579+ if (unlikely(last_jiffies &&
2580+ time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2581+ if (!tx_buf->print_once)
2582+ netif_notice(adapter, tx_err, adapter->netdev,
2583+ "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2584+ tx_ring->qid, i);
2585+
2586+ tx_buf->print_once = 1;
2587+ missed_tx++;
2588+
2589+ if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2590+ netif_err(adapter, tx_err, adapter->netdev,
2591+ "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2592+ missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2593+ set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2594+ return -EIO;
2595+ }
2596+ }
2597+ }
2598+
2599+ return 0;
2600+}
2601+
2602+static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2603+{
25572604 struct ena_ring *tx_ring;
2558− int i, j, budget;
2559− u32 missed_tx;
2605+ int i, budget, rc;
25602606
25612607 /* Make sure the driver doesn't turn the device in other process */
25622608 smp_rmb();
@@ -2572,31 +2618,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 9 unmodified lines
25722618 for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) {
25732619 tx_ring = &adapter->tx_ring[i];
25742620
2575− for (j = 0; j < tx_ring->ring_size; j++) {
2576− tx_buf = &tx_ring->tx_buffer_info[j];
2577− last_jiffies = tx_buf->last_jiffies;
2578− if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2579− netif_notice(adapter, tx_err, adapter->netdev,
2580− "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2581− tx_ring->qid, j);
2582−
2583− u64_stats_update_begin(&tx_ring->syncp);
2584− missed_tx = tx_ring->tx_stats.missing_tx_comp++;
2585− u64_stats_update_end(&tx_ring->syncp);
2586−
2587− /* Clear last jiffies so the lost buffer won't
2588− * be counted twice.
2589− */
2590− tx_buf->last_jiffies = 0;
2591−
2592− if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2593− netif_err(adapter, tx_err, adapter->netdev,
2594− "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n",
2595− missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2596− set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2597− }
2598− }
2599− }
2621+ rc = check_missing_comp_in_queue(adapter, tx_ring);
2622+ if (unlikely(rc))
2623+ return;
26002624
26012625 budget--;
26022626 if (!budget)
@@ -2606,6 +2630,58 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 3 unmodified lines
26062630 adapter->last_monitored_tx_qid = i % adapter->num_queues;
26072631 }
26082632
2633+/* trigger napi schedule after 2 consecutive detections */
2634+#define EMPTY_RX_REFILL 2
2635+/* For the rare case where the device runs out of Rx descriptors and the
2636+ * napi handler failed to refill new Rx descriptors (due to a lack of memory
2637+ * for example).
2638+ * This case will lead to a deadlock:
2639+ * The device won't send interrupts since all the new Rx packets will be dropped
2640+ * The napi handler won't allocate new Rx descriptors so the device will be
2641+ * able to send new packets.
2642+ *
2643+ * This scenario can happen when the kernel's vm.min_free_kbytes is too small.
2644+ * It is recommended to have at least 512MB, with a minimum of 128MB for
2645+ * constrained environment).
2646+ *
2647+ * When such a situation is detected - Reschedule napi
2648+ */
2649+static void check_for_empty_rx_ring(struct ena_adapter *adapter)
2650+{
2651+ struct ena_ring *rx_ring;
2652+ int i, refill_required;
2653+
2654+ if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
2655+ return;
2656+
2657+ if (test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))
2658+ return;
2659+
2660+ for (i = 0; i < adapter->num_queues; i++) {
2661+ rx_ring = &adapter->rx_ring[i];
2662+
2663+ refill_required =
2664+ ena_com_sq_empty_space(rx_ring->ena_com_io_sq);
2665+ if (unlikely(refill_required == (rx_ring->ring_size - 1))) {
2666+ rx_ring->empty_rx_queue++;
2667+
2668+ if (rx_ring->empty_rx_queue >= EMPTY_RX_REFILL) {
2669+ u64_stats_update_begin(&rx_ring->syncp);
2670+ rx_ring->rx_stats.empty_rx_ring++;
2671+ u64_stats_update_end(&rx_ring->syncp);
2672+
2673+ netif_err(adapter, drv, adapter->netdev,
2674+ "trigger refill for ring %d\n", i);
2675+
2676+ napi_schedule(rx_ring->napi);
2677+ rx_ring->empty_rx_queue = 0;
2678+ }
2679+ } else {
2680+ rx_ring->empty_rx_queue = 0;
2681+ }
2682+ }
2683+}
2684+
26092685 /* Check for keep alive expiration */
26102686 static void check_for_missing_keep_alive(struct ena_adapter *adapter)
26112687 {
@@ -2660,6 +2736,8 @@ static void ena_timer_service(unsigned long data) · 48 unmodified lines
26602736
26612737 check_for_missing_tx_completions(adapter);
26622738
2739+ check_for_empty_rx_ring(adapter);
2740+
26632741 if (debug_area)
26642742 ena_dump_stats_to_buf(adapter, debug_area);
26652743
@@ -2840,6 +2918,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) · 174 unmodified lines
28402918 {
28412919 int release_bars;
28422920
2921+ if (ena_dev->mem_bar)
2922+ devm_iounmap(&pdev->dev, ena_dev->mem_bar);
2923+
2924+ devm_iounmap(&pdev->dev, ena_dev->reg_bar);
2925+
28432926 release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
28442927 pci_release_selected_regions(pdev, release_bars);
28452928 }
@@ -2927,8 +3010,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines
29273010 goto err_free_ena_dev;
29283011 }
29293012
2930− ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR),
2931− pci_resource_len(pdev, ENA_REG_BAR));
3013+ ena_dev->reg_bar = devm_ioremap(&pdev->dev,
3014+ pci_resource_start(pdev, ENA_REG_BAR),
3015+ pci_resource_len(pdev, ENA_REG_BAR));
29323016 if (!ena_dev->reg_bar) {
29333017 dev_err(&pdev->dev, "failed to remap regs bar\n");
29343018 rc = -EFAULT;
@@ -2948,8 +3032,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 13 unmodified lines
29483032 ena_set_push_mode(pdev, ena_dev, &get_feat_ctx);
29493033
29503034 if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
2951− ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR),
2952− pci_resource_len(pdev, ENA_MEM_BAR));
3035+ ena_dev->mem_bar = devm_ioremap_wc(&pdev->dev,
3036+ pci_resource_start(pdev, ENA_MEM_BAR),
3037+ pci_resource_len(pdev, ENA_MEM_BAR));
29533038 if (!ena_dev->mem_bar) {
29543039 rc = -EFAULT;
29553040 goto err_device_destroy;
drivers/net/ethernet/amazon/ena/ena_netdev.h+15−3
@@ -45,7 +45,7 @@ · 44 unmodified lines
4545
4646 #define DRV_MODULE_VER_MAJOR 1
4747 #define DRV_MODULE_VER_MINOR 1
48−#define DRV_MODULE_VER_SUBMINOR 2
48+#define DRV_MODULE_VER_SUBMINOR 7
4949
5050 #define DRV_MODULE_NAME "ena"
5151 #ifndef DRV_MODULE_VERSION
@@ -146,7 +146,18 @@ struct ena_tx_buffer { · 94 unmodified lines
146146 u32 tx_descs;
147147 /* num of buffers used by this skb */
148148 u32 num_of_bufs;
149− /* Save the last jiffies to detect missing tx packets */
149+
150+ /* Used for detect missing tx packets to limit the number of prints */
151+ u32 print_once;
152+ /* Save the last jiffies to detect missing tx packets
153+ *
154+ * sets to non zero value on ena_start_xmit and set to zero on
155+ * napi and timer_Service_routine.
156+ *
157+ * while this value is not protected by lock,
158+ * a given packet is not expected to be handled by ena_start_xmit
159+ * and by napi/timer_service at the same time.
160+ */
150161 unsigned long last_jiffies;
151162 struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
152163 } ____cacheline_aligned;
@@ -170,7 +181,6 @@ struct ena_stats_tx { · 17 unmodified lines
170181 u64 napi_comp;
171182 u64 tx_poll;
172183 u64 doorbells;
173− u64 missing_tx_comp;
174184 u64 bad_req_id;
175185 };
176186
@@ -184,6 +194,7 @@ struct ena_stats_rx { · 7 unmodified lines
184194 u64 dma_mapping_err;
185195 u64 bad_desc_num;
186196 u64 rx_copybreak_pkt;
197+ u64 empty_rx_ring;
187198 };
188199
189200 struct ena_ring {
@@ -231,6 +242,7 @@ struct ena_ring { · 41 unmodified lines
231242 struct ena_stats_tx tx_stats;
232243 struct ena_stats_rx rx_stats;
233244 };
245+ int empty_rx_queue;
234246 } ____cacheline_aligned;
235247
236248 struct ena_stats_dev {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h+0−3
@@ -193,9 +193,6 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self, · 192 unmodified lines
193193 struct aq_hw_caps_s *aq_hw_caps,
194194 u32 *regs_buff);
195195
196−int hw_atl_utils_hw_get_settings(struct aq_hw_s *self,
197− struct ethtool_cmd *cmd);
198−
199196 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
200197 unsigned int power_state);
201198
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+15−4
@@ -3883,15 +3883,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3882 unmodified lines
38833883 /* when transmitting in a vf, start bd must hold the ethertype
38843884 * for fw to enforce it
38853885 */
3886+ u16 vlan_tci = 0;
38863887 #ifndef BNX2X_STOP_ON_ERROR
3887− if (IS_VF(bp))
3888+ if (IS_VF(bp)) {
38883889 #endif
3889− tx_start_bd->vlan_or_ethertype =
3890− cpu_to_le16(ntohs(eth->h_proto));
3890+ /* Still need to consider inband vlan for enforced */
3891+ if (__vlan_get_tag(skb, &vlan_tci)) {
3892+ tx_start_bd->vlan_or_ethertype =
3893+ cpu_to_le16(ntohs(eth->h_proto));
3894+ } else {
3895+ tx_start_bd->bd_flags.as_bitfield |=
3896+ (X_ETH_INBAND_VLAN <<
3897+ ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
3898+ tx_start_bd->vlan_or_ethertype =
3899+ cpu_to_le16(vlan_tci);
3900+ }
38913901 #ifndef BNX2X_STOP_ON_ERROR
3892− else
3902+ } else {
38933903 /* used by FW for packet accounting */
38943904 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
3905+ }
38953906 #endif
38963907 }
38973908
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+13−2
@@ -901,6 +901,8 @@ static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) · 900 unmodified lines
901901 /* release VF resources */
902902 bnx2x_vf_free_resc(bp, vf);
903903
904+ vf->malicious = false;
905+
904906 /* re-open the mailbox */
905907 bnx2x_vf_enable_mbx(bp, vf->abs_vfid);
906908 return;
@@ -1822,9 +1824,11 @@ get_vf: · 915 unmodified lines
18221824 vf->abs_vfid, qidx);
18231825 bnx2x_vf_handle_rss_update_eqe(bp, vf);
18241826 case EVENT_RING_OPCODE_VF_FLR:
1825− case EVENT_RING_OPCODE_MALICIOUS_VF:
18261827 /* Do nothing for now */
18271828 return 0;
1829+ case EVENT_RING_OPCODE_MALICIOUS_VF:
1830+ vf->malicious = true;
1831+ return 0;
18281832 }
18291833
18301834 return 0;
@@ -1905,6 +1909,13 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 74 unmodified lines
19051909 continue;
19061910 }
19071911
1912+ if (vf->malicious) {
1913+ DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
1914+ "vf %d malicious so no stats for it\n",
1915+ vf->abs_vfid);
1916+ continue;
1917+ }
1918+
19081919 DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
19091920 "add addresses for vf %d\n", vf->abs_vfid);
19101921 for_each_vfq(vf, j) {
@@ -3042,7 +3053,7 @@ void bnx2x_vf_pci_dealloc(struct bnx2x *bp) · 1131 unmodified lines
30423053 {
30433054 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
30443055 sizeof(struct bnx2x_vf_mbx_msg));
3045− BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,
3056+ BNX2X_PCI_FREE(bp->pf2vf_bulletin, bp->pf2vf_bulletin_mapping,
30463057 sizeof(union pf_vf_bulletin));
30473058 }
30483059
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+1−0
@@ -141,6 +141,7 @@ struct bnx2x_virtf { · 140 unmodified lines
141141 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
142142
143143 bool flr_clnup_stage; /* true during flr cleanup */
144+ bool malicious; /* true if FW indicated so, until FLR */
144145
145146 /* dma */
146147 dma_addr_t fw_stat_map;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+1−1
@@ -4668,7 +4668,7 @@ static void dummy_setup(struct net_device *dev) · 4667 unmodified lines
46684668 /* Initialize the device structure. */
46694669 dev->netdev_ops = &cxgb4_mgmt_netdev_ops;
46704670 dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops;
4671− dev->destructor = free_netdev;
4671+ dev->needs_free_netdev = true;
46724672 }
46734673
46744674 static int config_mgmt_dev(struct pci_dev *pdev)
drivers/net/ethernet/ibm/emac/core.c+40−27
@@ -343,6 +343,7 @@ static int emac_reset(struct emac_instance *dev) · 342 unmodified lines
343343 {
344344 struct emac_regs __iomem *p = dev->emacp;
345345 int n = 20;
346+ bool __maybe_unused try_internal_clock = false;
346347
347348 DBG(dev, "reset" NL);
348349
@@ -355,6 +356,7 @@ static int emac_reset(struct emac_instance *dev) · 6 unmodified lines
355356 }
356357
357358 #ifdef CONFIG_PPC_DCR_NATIVE
359+do_retry:
358360 /*
359361 * PPC460EX/GT Embedded Processor Advanced User's Manual
360362 * section 28.10.1 Mode Register 0 (EMACx_MR0) states:
@@ -362,10 +364,19 @@ static int emac_reset(struct emac_instance *dev) · 1 unmodified line
362364 * of the EMAC. If none is present, select the internal clock
363365 * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1).
364366 * After a soft reset, select the external clock.
367+ *
368+ * The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the
369+ * ethernet cable is not attached. This causes the reset to timeout
370+ * and the PHY detection code in emac_init_phy() is unable to
371+ * communicate and detect the AR8035-A PHY. As a result, the emac
372+ * driver bails out early and the user has no ethernet.
373+ * In order to stay compatible with existing configurations, the
374+ * driver will temporarily switch to the internal clock, after
375+ * the first reset fails.
365376 */
366377 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
367− if (dev->phy_address == 0xffffffff &&
368− dev->phy_map == 0xffffffff) {
378+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
379+ dev->phy_map == 0xffffffff)) {
369380 /* No PHY: select internal loop clock before reset */
370381 dcri_clrset(SDR0, SDR0_ETH_CFG,
371382 0, SDR0_ETH_CFG_ECS << dev->cell_index);
@@ -383,8 +394,15 @@ static int emac_reset(struct emac_instance *dev) · 11 unmodified lines
383394
384395 #ifdef CONFIG_PPC_DCR_NATIVE
385396 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
386− if (dev->phy_address == 0xffffffff &&
387− dev->phy_map == 0xffffffff) {
397+ if (!n && !try_internal_clock) {
398+ /* first attempt has timed out. */
399+ n = 20;
400+ try_internal_clock = true;
401+ goto do_retry;
402+ }
403+
404+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
405+ dev->phy_map == 0xffffffff)) {
388406 /* No PHY: restore external clock source after reset */
389407 dcri_clrset(SDR0, SDR0_ETH_CFG,
390408 SDR0_ETH_CFG_ECS << dev->cell_index, 0);
@@ -2460,20 +2478,24 @@ static int emac_mii_bus_reset(struct mii_bus *bus) · 2069 unmodified lines
24602478 return emac_reset(dev);
24612479 }
24622480
2481+static int emac_mdio_phy_start_aneg(struct mii_phy *phy,
2482+ struct phy_device *phy_dev)
2483+{
2484+ phy_dev->autoneg = phy->autoneg;
2485+ phy_dev->speed = phy->speed;
2486+ phy_dev->duplex = phy->duplex;
2487+ phy_dev->advertising = phy->advertising;
2488+ return phy_start_aneg(phy_dev);
2489+}
2490+
24632491 static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise)
24642492 {
24652493 struct net_device *ndev = phy->dev;
24662494 struct emac_instance *dev = netdev_priv(ndev);
24672495
2468− dev->phy.autoneg = AUTONEG_ENABLE;
2469− dev->phy.speed = SPEED_1000;
2470− dev->phy.duplex = DUPLEX_FULL;
2471− dev->phy.advertising = advertise;
24722496 phy->autoneg = AUTONEG_ENABLE;
2473− phy->speed = dev->phy.speed;
2474− phy->duplex = dev->phy.duplex;
24752497 phy->advertising = advertise;
2476− return phy_start_aneg(dev->phy_dev);
2498+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24772499 }
24782500
24792501 static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd)
@@ -2481,13 +2503,10 @@ static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) · 1 unmodified line
24812503 struct net_device *ndev = phy->dev;
24822504 struct emac_instance *dev = netdev_priv(ndev);
24832505
2484− dev->phy.autoneg = AUTONEG_DISABLE;
2485− dev->phy.speed = speed;
2486− dev->phy.duplex = fd;
24872506 phy->autoneg = AUTONEG_DISABLE;
24882507 phy->speed = speed;
24892508 phy->duplex = fd;
2490− return phy_start_aneg(dev->phy_dev);
2509+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24912510 }
24922511
24932512 static int emac_mdio_poll_link(struct mii_phy *phy)
@@ -2509,16 +2528,17 @@ static int emac_mdio_read_link(struct mii_phy *phy) · 15 unmodified lines
25092528 {
25102529 struct net_device *ndev = phy->dev;
25112530 struct emac_instance *dev = netdev_priv(ndev);
2531+ struct phy_device *phy_dev = dev->phy_dev;
25122532 int res;
25132533
2514− res = phy_read_status(dev->phy_dev);
2534+ res = phy_read_status(phy_dev);
25152535 if (res)
25162536 return res;
25172537
2518− dev->phy.speed = phy->speed;
2519− dev->phy.duplex = phy->duplex;
2520− dev->phy.pause = phy->pause;
2521− dev->phy.asym_pause = phy->asym_pause;
2538+ phy->speed = phy_dev->speed;
2539+ phy->duplex = phy_dev->duplex;
2540+ phy->pause = phy_dev->pause;
2541+ phy->asym_pause = phy_dev->asym_pause;
25222542 return 0;
25232543 }
25242544
@@ -2528,13 +2548,6 @@ static int emac_mdio_init_phy(struct mii_phy *phy) · 3 unmodified lines
25282548 struct emac_instance *dev = netdev_priv(ndev);
25292549
25302550 phy_start(dev->phy_dev);
2531− dev->phy.autoneg = phy->autoneg;
2532− dev->phy.speed = phy->speed;
2533− dev->phy.duplex = phy->duplex;
2534− dev->phy.advertising = phy->advertising;
2535− dev->phy.pause = phy->pause;
2536− dev->phy.asym_pause = phy->asym_pause;
2537−
25382551 return phy_init_hw(dev->phy_dev);
25392552 }
25402553
drivers/net/ethernet/ibm/ibmvnic.c+6−0
@@ -1588,6 +1588,11 @@ static void ibmvnic_netpoll_controller(struct net_device *dev) · 1587 unmodified lines
15881588 }
15891589 #endif
15901590
1591+static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu)
1592+{
1593+ return -EOPNOTSUPP;
1594+}
1595+
15911596 static const struct net_device_ops ibmvnic_netdev_ops = {
15921597 .ndo_open = ibmvnic_open,
15931598 .ndo_stop = ibmvnic_close,
@@ -1599,6 +1604,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 5 unmodified lines
15991604 #ifdef CONFIG_NET_POLL_CONTROLLER
16001605 .ndo_poll_controller = ibmvnic_netpoll_controller,
16011606 #endif
1607+ .ndo_change_mtu = ibmvnic_change_mtu,
16021608 };
16031609
16041610 /* ethtool functions */
drivers/net/ethernet/intel/i40e/i40e.h+1−0
@@ -399,6 +399,7 @@ struct i40e_pf { · 398 unmodified lines
399399 #define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1)
400400 #define I40E_FLAG_MSI_ENABLED BIT_ULL(2)
401401 #define I40E_FLAG_MSIX_ENABLED BIT_ULL(3)
402+#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4)
402403 #define I40E_FLAG_RSS_ENABLED BIT_ULL(6)
403404 #define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7)
404405 #define I40E_FLAG_IWARP_ENABLED BIT_ULL(10)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+2−2
@@ -225,7 +225,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = { · 224 unmodified lines
225225 I40E_PRIV_FLAG("LinkPolling", I40E_FLAG_LINK_POLLING_ENABLED, 0),
226226 I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0),
227227 I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0),
228− I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0),
228+ I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0),
229229 I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0),
230230 };
231231
@@ -4093,7 +4093,7 @@ flags_complete: · 3861 unmodified lines
40934093
40944094 /* Only allow ATR evict on hardware that is capable of handling it */
40954095 if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
4096− pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE;
4096+ pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED;
40974097
40984098 if (changed_flags & I40E_FLAG_TRUE_PROMISC_SUPPORT) {
40994099 u16 sw_flags = 0, valid_flags = 0;
drivers/net/ethernet/intel/i40e/i40e_main.c+4−3
@@ -8823,11 +8823,12 @@ static int i40e_sw_init(struct i40e_pf *pf) · 8822 unmodified lines
88238823 (pf->hw.aq.api_min_ver > 4))) {
88248824 /* Supported in FW API version higher than 1.4 */
88258825 pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
8826− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
8827− } else {
8828− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
88298826 }
88308827
8828+ /* Enable HW ATR eviction if possible */
8829+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
8830+ pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED;
8831+
88318832 pf->eeprom_version = 0xDEAD;
88328833 pf->lan_veb = I40E_NO_VEB;
88338834 pf->lan_vsi = I40E_NO_VSI;
drivers/net/ethernet/intel/i40e/i40e_txrx.c+2−2
@@ -2341,7 +2341,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 2340 unmodified lines
23412341 /* Due to lack of space, no more new filters can be programmed */
23422342 if (th->syn && (pf->flags & I40E_FLAG_FD_ATR_AUTO_DISABLED))
23432343 return;
2344− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) {
2344+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) {
23452345 /* HW ATR eviction will take care of removing filters on FIN
23462346 * and RST packets.
23472347 */
@@ -2403,7 +2403,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 55 unmodified lines
24032403 I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
24042404 I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
24052405
2406− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
2406+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED)
24072407 dtype_cmd |= I40E_TXD_FLTR_QW1_ATR_MASK;
24082408
24092409 fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+2−0
@@ -2876,10 +2876,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 2875 unmodified lines
28762876 VLAN_VID_MASK));
28772877 }
28782878
2879+ spin_unlock_bh(&vsi->mac_filter_hash_lock);
28792880 if (vlan_id || qos)
28802881 ret = i40e_vsi_add_pvid(vsi, vlanprio);
28812882 else
28822883 i40e_vsi_remove_pvid(vsi);
2884+ spin_lock_bh(&vsi->mac_filter_hash_lock);
28832885
28842886 if (vlan_id) {
28852887 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
drivers/net/ethernet/marvell/mvpp2.c+33−43
@@ -3725,7 +3725,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 3724 unmodified lines
37253725 dma_addr_t *dma_addr,
37263726 phys_addr_t *phys_addr)
37273727 {
3728− int cpu = smp_processor_id();
3728+ int cpu = get_cpu();
37293729
37303730 *dma_addr = mvpp2_percpu_read(priv, cpu,
37313731 MVPP2_BM_PHY_ALLOC_REG(bm_pool->id));
@@ -3746,6 +3746,8 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 14 unmodified lines
37463746 if (sizeof(phys_addr_t) == 8)
37473747 *phys_addr |= (u64)phys_addr_highbits << 32;
37483748 }
3749+
3750+ put_cpu();
37493751 }
37503752
37513753 /* Free all buffers from the pool */
@@ -3926,18 +3928,12 @@ static inline u32 mvpp2_bm_cookie_pool_set(u32 cookie, int pool) · 174 unmodified lines
39263928 return bm;
39273929 }
39283930
3929−/* Get pool number from a BM cookie */
3930−static inline int mvpp2_bm_cookie_pool_get(unsigned long cookie)
3931−{
3932− return (cookie >> MVPP2_BM_COOKIE_POOL_OFFS) & 0xFF;
3933−}
3934−
39353931 /* Release buffer to BM */
39363932 static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool,
39373933 dma_addr_t buf_dma_addr,
39383934 phys_addr_t buf_phys_addr)
39393935 {
3940− int cpu = smp_processor_id();
3936+ int cpu = get_cpu();
39413937
39423938 if (port->priv->hw_version == MVPP22) {
39433939 u32 val = 0;
@@ -3964,15 +3960,15 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, · 20 unmodified lines
39643960 MVPP2_BM_VIRT_RLS_REG, buf_phys_addr);
39653961 mvpp2_percpu_write(port->priv, cpu,
39663962 MVPP2_BM_PHY_RLS_REG(pool), buf_dma_addr);
3963+
3964+ put_cpu();
39673965 }
39683966
39693967 /* Refill BM pool */
3970−static void mvpp2_pool_refill(struct mvpp2_port *port, u32 bm,
3968+static void mvpp2_pool_refill(struct mvpp2_port *port, int pool,
39713969 dma_addr_t dma_addr,
39723970 phys_addr_t phys_addr)
39733971 {
3974− int pool = mvpp2_bm_cookie_pool_get(bm);
3975−
39763972 mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
39773973 }
39783974
@@ -4192,8 +4188,6 @@ static void mvpp22_port_mii_set(struct mvpp2_port *port) · 213 unmodified lines
41924188 {
41934189 u32 val;
41944190
4195− return;
4196−
41974191 /* Only GOP port 0 has an XLG MAC */
41984192 if (port->gop_id == 0) {
41994193 val = readl(port->base + MVPP22_XLG_CTRL3_REG);
@@ -4548,21 +4542,6 @@ static void mvpp2_rxq_offset_set(struct mvpp2_port *port, · 348 unmodified lines
45484542 mvpp2_write(port->priv, MVPP2_RXQ_CONFIG_REG(prxq), val);
45494543 }
45504544
4551−/* Obtain BM cookie information from descriptor */
4552−static u32 mvpp2_bm_cookie_build(struct mvpp2_port *port,
4553− struct mvpp2_rx_desc *rx_desc)
4554−{
4555− int cpu = smp_processor_id();
4556− int pool;
4557−
4558− pool = (mvpp2_rxdesc_status_get(port, rx_desc) &
4559− MVPP2_RXD_BM_POOL_ID_MASK) >>
4560− MVPP2_RXD_BM_POOL_ID_OFFS;
4561−
4562− return ((pool & 0xFF) << MVPP2_BM_COOKIE_POOL_OFFS) |
4563− ((cpu & 0xFF) << MVPP2_BM_COOKIE_CPU_OFFS);
4564−}
4565−
45664545 /* Tx descriptors helper methods */
45674546
45684547 /* Get pointer to next Tx descriptor to be processed (send) by HW */
@@ -4790,7 +4769,7 @@ static void mvpp2_txp_max_tx_size_set(struct mvpp2_port *port) · 221 unmodified lines
47904769 static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port,
47914770 struct mvpp2_rx_queue *rxq)
47924771 {
4793− int cpu = smp_processor_id();
4772+ int cpu = get_cpu();
47944773
47954774 if (rxq->pkts_coal > MVPP2_OCCUPIED_THRESH_MASK)
47964775 rxq->pkts_coal = MVPP2_OCCUPIED_THRESH_MASK;
@@ -4798,6 +4777,8 @@ static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, · 1 unmodified line
47984777 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
47994778 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_THRESH_REG,
48004779 rxq->pkts_coal);
4780+
4781+ put_cpu();
48014782 }
48024783
48034784 static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz)
@@ -4978,7 +4959,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 174 unmodified lines
49784959 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
49794960
49804961 /* Set Rx descriptors queue starting address - indirect access */
4981− cpu = smp_processor_id();
4962+ cpu = get_cpu();
49824963 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
49834964 if (port->priv->hw_version == MVPP21)
49844965 rxq_dma = rxq->descs_dma;
@@ -4987,6 +4968,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 2 unmodified lines
49874968 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, rxq_dma);
49884969 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, rxq->size);
49894970 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_INDEX_REG, 0);
4971+ put_cpu();
49904972
49914973 /* Set Offset */
49924974 mvpp2_rxq_offset_set(port, rxq->id, NET_SKB_PAD);
@@ -5013,9 +4995,13 @@ static void mvpp2_rxq_drop_pkts(struct mvpp2_port *port, · 20 unmodified lines
50134995
50144996 for (i = 0; i < rx_received; i++) {
50154997 struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq);
5016− u32 bm = mvpp2_bm_cookie_build(port, rx_desc);
4998+ u32 status = mvpp2_rxdesc_status_get(port, rx_desc);
4999+ int pool;
5000+
5001+ pool = (status & MVPP2_RXD_BM_POOL_ID_MASK) >>
5002+ MVPP2_RXD_BM_POOL_ID_OFFS;
50175003
5018− mvpp2_pool_refill(port, bm,
5004+ mvpp2_pool_refill(port, pool,
50195005 mvpp2_rxdesc_dma_addr_get(port, rx_desc),
50205006 mvpp2_rxdesc_cookie_get(port, rx_desc));
50215007 }
@@ -5045,10 +5031,11 @@ static void mvpp2_rxq_deinit(struct mvpp2_port *port, · 23 unmodified lines
50455031 * free descriptor number
50465032 */
50475033 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
5048− cpu = smp_processor_id();
5034+ cpu = get_cpu();
50495035 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
50505036 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, 0);
50515037 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, 0);
5038+ put_cpu();
50525039 }
50535040
50545041 /* Create and initialize a Tx queue */
@@ -5071,7 +5058,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 16 unmodified lines
50715058 txq->last_desc = txq->size - 1;
50725059
50735060 /* Set Tx descriptors queue starting address - indirect access */
5074− cpu = smp_processor_id();
5061+ cpu = get_cpu();
50755062 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
50765063 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG,
50775064 txq->descs_dma);
@@ -5096,6 +5083,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 18 unmodified lines
50965083 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG,
50975084 MVPP2_PREF_BUF_PTR(desc) | MVPP2_PREF_BUF_SIZE_16 |
50985085 MVPP2_PREF_BUF_THRESH(desc_per_txq / 2));
5086+ put_cpu();
50995087
51005088 /* WRR / EJP configuration - indirect access */
51015089 tx_port_num = mvpp2_egress_port(port);
@@ -5166,10 +5154,11 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 64 unmodified lines
51665154 mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0);
51675155
51685156 /* Set Tx descriptors queue starting address and size */
5169− cpu = smp_processor_id();
5157+ cpu = get_cpu();
51705158 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51715159 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, 0);
51725160 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_SIZE_REG, 0);
5161+ put_cpu();
51735162 }
51745163
51755164 /* Cleanup Tx ports */
@@ -5179,7 +5168,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 3 unmodified lines
51795168 int delay, pending, cpu;
51805169 u32 val;
51815170
5182− cpu = smp_processor_id();
5171+ cpu = get_cpu();
51835172 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51845173 val = mvpp2_percpu_read(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG);
51855174 val |= MVPP2_TXQ_DRAIN_EN_MASK;
@@ -5206,6 +5195,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 20 unmodified lines
52065195
52075196 val &= ~MVPP2_TXQ_DRAIN_EN_MASK;
52085197 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, val);
5198+ put_cpu();
52095199
52105200 for_each_present_cpu(cpu) {
52115201 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
@@ -5453,7 +5443,7 @@ static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status, · 241 unmodified lines
54535443
54545444 /* Reuse skb if possible, or allocate a new skb and add it to BM pool */
54555445 static int mvpp2_rx_refill(struct mvpp2_port *port,
5456− struct mvpp2_bm_pool *bm_pool, u32 bm)
5446+ struct mvpp2_bm_pool *bm_pool, int pool)
54575447 {
54585448 dma_addr_t dma_addr;
54595449 phys_addr_t phys_addr;
@@ -5465,7 +5455,7 @@ static int mvpp2_rx_refill(struct mvpp2_port *port, · 5 unmodified lines
54655455 if (!buf)
54665456 return -ENOMEM;
54675457
5468− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5458+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
54695459
54705460 return 0;
54715461 }
@@ -5523,7 +5513,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 51 unmodified lines
55235513 unsigned int frag_size;
55245514 dma_addr_t dma_addr;
55255515 phys_addr_t phys_addr;
5526− u32 bm, rx_status;
5516+ u32 rx_status;
55275517 int pool, rx_bytes, err;
55285518 void *data;
55295519
@@ -5535,8 +5525,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 5 unmodified lines
55355525 phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
55365526 data = (void *)phys_to_virt(phys_addr);
55375527
5538− bm = mvpp2_bm_cookie_build(port, rx_desc);
5539− pool = mvpp2_bm_cookie_pool_get(bm);
5528+ pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >>
5529+ MVPP2_RXD_BM_POOL_ID_OFFS;
55405530 bm_pool = &port->priv->bm_pools[pool];
55415531
55425532 /* In case of an error, release the requested buffer pointer
@@ -5549,7 +5539,7 @@ err_drop_frame: · 6 unmodified lines
55495539 dev->stats.rx_errors++;
55505540 mvpp2_rx_error(port, rx_desc);
55515541 /* Return the buffer to the pool */
5552− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5542+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
55535543 continue;
55545544 }
55555545
@@ -5564,7 +5554,7 @@ err_drop_frame: · 8 unmodified lines
55645554 goto err_drop_frame;
55655555 }
55665556
5567− err = mvpp2_rx_refill(port, bm_pool, bm);
5557+ err = mvpp2_rx_refill(port, bm_pool, pool);
55685558 if (err) {
55695559 netdev_err(port->dev, "failed to refill BM pools\n");
55705560 goto err_drop_frame;
drivers/net/ethernet/mellanox/mlx5/core/en.h+5−3
@@ -458,13 +458,15 @@ struct mlx5e_mpw_info { · 457 unmodified lines
458458
459459 struct mlx5e_rx_am_stats {
460460 int ppms; /* packets per msec */
461+ int bpms; /* bytes per msec */
461462 int epms; /* events per msec */
462463 };
463464
464465 struct mlx5e_rx_am_sample {
465− ktime_t time;
466− unsigned int pkt_ctr;
467− u16 event_ctr;
466+ ktime_t time;
467+ u32 pkt_ctr;
468+ u32 byte_ctr;
469+ u16 event_ctr;
468470 };
469471
470472 struct mlx5e_rx_am { /* Adaptive Moderation */
drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c+26−19
@@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) · 182 unmodified lines
183183 mlx5e_am_step(am);
184184 }
185185
186+#define IS_SIGNIFICANT_DIFF(val, ref) \
187+ (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
188+
186189 static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
187190 struct mlx5e_rx_am_stats *prev)
188191 {
189− int diff;
190−
191− if (!prev->ppms)
192− return curr->ppms ? MLX5E_AM_STATS_BETTER :
192+ if (!prev->bpms)
193+ return curr->bpms ? MLX5E_AM_STATS_BETTER :
193194 MLX5E_AM_STATS_SAME;
194195
195− diff = curr->ppms - prev->ppms;
196− if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */
197− return (diff > 0) ? MLX5E_AM_STATS_BETTER :
198− MLX5E_AM_STATS_WORSE;
196+ if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
197+ return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
198+ MLX5E_AM_STATS_WORSE;
199199
200− if (!prev->epms)
201− return curr->epms ? MLX5E_AM_STATS_WORSE :
202− MLX5E_AM_STATS_SAME;
200+ if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
201+ return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
202+ MLX5E_AM_STATS_WORSE;
203203
204− diff = curr->epms - prev->epms;
205− if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */
206− return (diff < 0) ? MLX5E_AM_STATS_BETTER :
207− MLX5E_AM_STATS_WORSE;
204+ if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
205+ return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
206+ MLX5E_AM_STATS_WORSE;
208207
209208 return MLX5E_AM_STATS_SAME;
210209 }
@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, · 55 unmodified lines
266265 {
267266 s->time = ktime_get();
268267 s->pkt_ctr = rq->stats.packets;
268+ s->byte_ctr = rq->stats.bytes;
269269 s->event_ctr = rq->cq.event_ctr;
270270 }
271271
272272 #define MLX5E_AM_NEVENTS 64
273+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
274+#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
273275
274276 static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
275277 struct mlx5e_rx_am_sample *end,
@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, · 1 unmodified line
277279 {
278280 /* u32 holds up to 71 minutes, should be enough */
279281 u32 delta_us = ktime_us_delta(end->time, start->time);
280− unsigned int npkts = end->pkt_ctr - start->pkt_ctr;
282+ u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
283+ u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
284+ start->byte_ctr);
281285
282286 if (!delta_us)
283287 return;
284288
285− curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us;
286− curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us;
289+ curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
290+ curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
291+ curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC,
292+ delta_us);
287293 }
288294
289295 void mlx5e_rx_am_work(struct work_struct *work)
@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) · 18 unmodified lines
308314
309315 switch (am->state) {
310316 case MLX5E_AM_MEASURE_IN_PROGRESS:
311− nevents = rq->cq.event_ctr - am->start_sample.event_ctr;
317+ nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr,
318+ am->start_sample.event_ctr);
312319 if (nevents < MLX5E_AM_NEVENTS)
313320 break;
314321 mlx5e_am_sample(rq, &end_sample);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+2−9
@@ -417,20 +417,13 @@ struct mlx5e_stats { · 416 unmodified lines
417417 };
418418
419419 static const struct counter_desc mlx5e_pme_status_desc[] = {
420− { "module_plug", 0 },
421420 { "module_unplug", 8 },
422421 };
423422
424423 static const struct counter_desc mlx5e_pme_error_desc[] = {
425− { "module_pwr_budget_exd", 0 }, /* power budget exceed */
426− { "module_long_range", 8 }, /* long range for non MLNX cable */
427− { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
428− { "module_no_eeprom", 24 }, /* no eeprom/retry time out */
429− { "module_enforce_part", 32 }, /* enforce part number list */
430− { "module_unknown_id", 40 }, /* unknown identifier */
431− { "module_high_temp", 48 }, /* high temperature */
424+ { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
425+ { "module_high_temp", 48 }, /* high temperature */
432426 { "module_bad_shorted", 56 }, /* bad or shorted cable/module */
433− { "module_unknown_status", 64 },
434427 };
435428
436429 #endif /* __MLX5_EN_STATS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+1−1
@@ -860,7 +860,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace · 859 unmodified lines
860860 ft_attr.level = level;
861861 ft_attr.prio = prio;
862862
863− return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0);
863+ return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport);
864864 }
865865
866866 struct mlx5_flow_table*
drivers/net/ethernet/mellanox/mlx5/core/health.c+5−6
@@ -290,10 +290,8 @@ static void poll_health(unsigned long data) · 289 unmodified lines
290290 struct mlx5_core_health *health = &dev->priv.health;
291291 u32 count;
292292
293− if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
294− mod_timer(&health->timer, get_next_poll_jiffies());
295− return;
296− }
293+ if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
294+ goto out;
297295
298296 count = ioread32be(health->health_counter);
299297 if (count == health->prev)
@@ -305,8 +303,6 @@ static void poll_health(unsigned long data) · 5 unmodified lines
305303 if (health->miss_counter == MAX_MISSES) {
306304 dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n");
307305 print_health_info(dev);
308− } else {
309− mod_timer(&health->timer, get_next_poll_jiffies());
310306 }
311307
312308 if (in_fatal(dev) && !health->sick) {
@@ -314,6 +310,9 @@ static void poll_health(unsigned long data) · 1 unmodified line
314310 print_health_info(dev);
315311 mlx5_trigger_health_work(dev);
316312 }
313+
314+out:
315+ mod_timer(&health->timer, get_next_poll_jiffies());
317316 }
318317
319318 void mlx5_start_health_poll(struct mlx5_core_dev *dev)
drivers/net/ethernet/mellanox/mlx5/core/main.c+4−2
@@ -538,8 +538,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 537 unmodified lines
538538 /* disable cmdif checksum */
539539 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
540540
541− /* If the HCA supports 4K UARs use it */
542− if (MLX5_CAP_GEN_MAX(dev, uar_4k))
541+ /* Enable 4K UAR only when HCA supports it and page size is bigger
542+ * than 4K.
543+ */
544+ if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096)
543545 MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1);
544546
545547 MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c+7−4
@@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) · 213 unmodified lines
214214 {
215215 /* Context type from W/B descriptor must be zero */
216216 if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE)
217− return -EINVAL;
217+ return 0;
218218
219219 /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */
220220 if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS)
221− return 0;
221+ return 1;
222222
223− return 1;
223+ return 0;
224224 }
225225
226226 static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
@@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) · 55 unmodified lines
282282 }
283283 }
284284 exit:
285− return ret;
285+ if (likely(ret == 0))
286+ return 1;
287+
288+ return 0;
286289 }
287290
288291 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+17−8
@@ -445,14 +445,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, · 444 unmodified lines
445445 return;
446446
447447 /* check tx tstamp status */
448− if (!priv->hw->desc->get_tx_timestamp_status(p)) {
448+ if (priv->hw->desc->get_tx_timestamp_status(p)) {
449449 /* get the valid tstamp */
450450 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
451451
452452 memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
453453 shhwtstamp.hwtstamp = ns_to_ktime(ns);
454454
455− netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns);
455+ netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns);
456456 /* pass tstamp to stack */
457457 skb_tstamp_tx(skb, &shhwtstamp);
458458 }
@@ -479,19 +479,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, · 20 unmodified lines
479479 return;
480480
481481 /* Check if timestamp is available */
482− if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
482+ if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
483483 /* For GMAC4, the valid timestamp is from CTX next desc. */
484484 if (priv->plat->has_gmac4)
485485 ns = priv->hw->desc->get_timestamp(np, priv->adv_ts);
486486 else
487487 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
488488
489− netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns);
489+ netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
490490 shhwtstamp = skb_hwtstamps(skb);
491491 memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
492492 shhwtstamp->hwtstamp = ns_to_ktime(ns);
493493 } else {
494− netdev_err(priv->dev, "cannot get RX hw timestamp\n");
494+ netdev_dbg(priv->dev, "cannot get RX hw timestamp\n");
495495 }
496496 }
497497
@@ -557,7 +557,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 59 unmodified lines
557557 /* PTP v1, UDP, any kind of event packet */
558558 config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
559559 /* take time stamp for all event messages */
560− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
560+ if (priv->plat->has_gmac4)
561+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
562+ else
563+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
561564
562565 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
563566 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -589,7 +592,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 25 unmodified lines
589592 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
590593 ptp_v2 = PTP_TCR_TSVER2ENA;
591594 /* take time stamp for all event messages */
592− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
595+ if (priv->plat->has_gmac4)
596+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
597+ else
598+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
593599
594600 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
595601 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -623,7 +629,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 27 unmodified lines
623629 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
624630 ptp_v2 = PTP_TCR_TSVER2ENA;
625631 /* take time stamp for all event messages */
626− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
632+ if (priv->plat->has_gmac4)
633+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
634+ else
635+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
627636
628637 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
629638 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h+2−1
@@ -59,7 +59,8 @@ · 58 unmodified lines
5959 /* Enable Snapshot for Messages Relevant to Master */
6060 #define PTP_TCR_TSMSTRENA BIT(15)
6161 /* Select PTP packets for Taking Snapshots */
62−#define PTP_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
62+#define PTP_TCR_SNAPTYPSEL_1 BIT(16)
63+#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
6364 /* Enable MAC address for PTP Frame Filtering */
6465 #define PTP_TCR_TSENMACADDR BIT(18)
6566
drivers/net/geneve.c+1−1
@@ -1019,7 +1019,7 @@ static void geneve_setup(struct net_device *dev) · 1018 unmodified lines
10191019
10201020 dev->netdev_ops = &geneve_netdev_ops;
10211021 dev->ethtool_ops = &geneve_ethtool_ops;
1022− dev->destructor = free_netdev;
1022+ dev->needs_free_netdev = true;
10231023
10241024 SET_NETDEV_DEVTYPE(dev, &geneve_type);
10251025
drivers/net/gtp.c+1−1
@@ -611,7 +611,7 @@ static const struct net_device_ops gtp_netdev_ops = { · 610 unmodified lines
611611 static void gtp_link_setup(struct net_device *dev)
612612 {
613613 dev->netdev_ops = &gtp_netdev_ops;
614− dev->destructor = free_netdev;
614+ dev->needs_free_netdev = true;
615615
616616 dev->hard_header_len = 0;
617617 dev->addr_len = 0;
drivers/net/hamradio/6pack.c+1−1
@@ -311,7 +311,7 @@ static void sp_setup(struct net_device *dev) · 310 unmodified lines
311311 {
312312 /* Finish setting up the DEVICE info. */
313313 dev->netdev_ops = &sp_netdev_ops;
314− dev->destructor = free_netdev;
314+ dev->needs_free_netdev = true;
315315 dev->mtu = SIXP_MTU;
316316 dev->hard_header_len = AX25_MAX_HEADER_LEN;
317317 dev->header_ops = &ax25_header_ops;
drivers/net/hamradio/bpqether.c+1−1
@@ -476,7 +476,7 @@ static const struct net_device_ops bpq_netdev_ops = { · 475 unmodified lines
476476 static void bpq_setup(struct net_device *dev)
477477 {
478478 dev->netdev_ops = &bpq_netdev_ops;
479− dev->destructor = free_netdev;
479+ dev->needs_free_netdev = true;
480480
481481 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
482482 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
drivers/net/hyperv/hyperv_net.h+3−2
@@ -171,6 +171,8 @@ struct rndis_device { · 170 unmodified lines
171171 spinlock_t request_lock;
172172 struct list_head req_list;
173173
174+ struct work_struct mcast_work;
175+
174176 u8 hw_mac_adr[ETH_ALEN];
175177 u8 rss_key[NETVSC_HASH_KEYLEN];
176178 u16 ind_table[ITAB_NUM];
@@ -201,6 +203,7 @@ int rndis_filter_open(struct netvsc_device *nvdev); · 24 unmodified lines
201203 int rndis_filter_close(struct netvsc_device *nvdev);
202204 int rndis_filter_device_add(struct hv_device *dev,
203205 struct netvsc_device_info *info);
206+void rndis_filter_update(struct netvsc_device *nvdev);
204207 void rndis_filter_device_remove(struct hv_device *dev,
205208 struct netvsc_device *nvdev);
206209 int rndis_filter_set_rss_param(struct rndis_device *rdev,
@@ -211,7 +214,6 @@ int rndis_filter_receive(struct net_device *ndev, · 4 unmodified lines
211214 struct vmbus_channel *channel,
212215 void *data, u32 buflen);
213216
214−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
215217 int rndis_filter_set_device_mac(struct net_device *ndev, char *mac);
216218
217219 void netvsc_switch_datapath(struct net_device *nv_dev, bool vf);
@@ -696,7 +698,6 @@ struct net_device_context { · 478 unmodified lines
696698 /* list protection */
697699 spinlock_t lock;
698700
699− struct work_struct work;
700701 u32 msg_enable; /* debug level */
701702
702703 u32 tx_checksum_mask;
drivers/net/hyperv/netvsc_drv.c+18−36
@@ -58,37 +58,12 @@ static int debug = -1; · 57 unmodified lines
5858 module_param(debug, int, S_IRUGO);
5959 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
6060
61−static void do_set_multicast(struct work_struct *w)
62−{
63− struct net_device_context *ndevctx =
64− container_of(w, struct net_device_context, work);
65− struct hv_device *device_obj = ndevctx->device_ctx;
66− struct net_device *ndev = hv_get_drvdata(device_obj);
67− struct netvsc_device *nvdev = rcu_dereference(ndevctx->nvdev);
68− struct rndis_device *rdev;
69−
70− if (!nvdev)
71− return;
72−
73− rdev = nvdev->extension;
74− if (rdev == NULL)
75− return;
76−
77− if (ndev->flags & IFF_PROMISC)
78− rndis_filter_set_packet_filter(rdev,
79− NDIS_PACKET_TYPE_PROMISCUOUS);
80− else
81− rndis_filter_set_packet_filter(rdev,
82− NDIS_PACKET_TYPE_BROADCAST |
83− NDIS_PACKET_TYPE_ALL_MULTICAST |
84− NDIS_PACKET_TYPE_DIRECTED);
85−}
86−
8761 static void netvsc_set_multicast_list(struct net_device *net)
8862 {
8963 struct net_device_context *net_device_ctx = netdev_priv(net);
64+ struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
9065
91− schedule_work(&net_device_ctx->work);
66+ rndis_filter_update(nvdev);
9267 }
9368
9469 static int netvsc_open(struct net_device *net)
@@ -125,8 +100,6 @@ static int netvsc_close(struct net_device *net) · 30 unmodified lines
125100
126101 netif_tx_disable(net);
127102
128− /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */
129− cancel_work_sync(&net_device_ctx->work);
130103 ret = rndis_filter_close(nvdev);
131104 if (ret != 0) {
132105 netdev_err(net, "unable to close device (ret %d).\n", ret);
@@ -1003,7 +976,7 @@ static const struct { · 870 unmodified lines
1003976 static int netvsc_get_sset_count(struct net_device *dev, int string_set)
1004977 {
1005978 struct net_device_context *ndc = netdev_priv(dev);
1006− struct netvsc_device *nvdev = rcu_dereference(ndc->nvdev);
979+ struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
1007980
1008981 if (!nvdev)
1009982 return -ENODEV;
@@ -1133,11 +1106,22 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 123 unmodified lines
11331106 }
11341107
11351108 #ifdef CONFIG_NET_POLL_CONTROLLER
1136−static void netvsc_poll_controller(struct net_device *net)
1109+static void netvsc_poll_controller(struct net_device *dev)
11371110 {
1138− /* As netvsc_start_xmit() works synchronous we don't have to
1139− * trigger anything here.
1140− */
1111+ struct net_device_context *ndc = netdev_priv(dev);
1112+ struct netvsc_device *ndev;
1113+ int i;
1114+
1115+ rcu_read_lock();
1116+ ndev = rcu_dereference(ndc->nvdev);
1117+ if (ndev) {
1118+ for (i = 0; i < ndev->num_chn; i++) {
1119+ struct netvsc_channel *nvchan = &ndev->chan_table[i];
1120+
1121+ napi_schedule(&nvchan->napi);
1122+ }
1123+ }
1124+ rcu_read_unlock();
11411125 }
11421126 #endif
11431127
@@ -1527,7 +1511,6 @@ static int netvsc_probe(struct hv_device *dev, · 383 unmodified lines
15271511 hv_set_drvdata(dev, net);
15281512
15291513 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change);
1530− INIT_WORK(&net_device_ctx->work, do_set_multicast);
15311514
15321515 spin_lock_init(&net_device_ctx->lock);
15331516 INIT_LIST_HEAD(&net_device_ctx->reconfig_events);
@@ -1597,7 +1580,6 @@ static int netvsc_remove(struct hv_device *dev) · 63 unmodified lines
15971580 netif_device_detach(net);
15981581
15991582 cancel_delayed_work_sync(&ndev_ctx->dwork);
1600− cancel_work_sync(&ndev_ctx->work);
16011583
16021584 /*
16031585 * Call to the vsc driver to let it know that the device is being
drivers/net/hyperv/rndis_filter.c+29−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131
3232 #include "hyperv_net.h"
3333
34+static void rndis_set_multicast(struct work_struct *w);
3435
3536 #define RNDIS_EXT_LEN PAGE_SIZE
3637 struct rndis_request {
@@ -76,6 +77,7 @@ static struct rndis_device *get_rndis_device(void) · 39 unmodified lines
7677 spin_lock_init(&device->request_lock);
7778
7879 INIT_LIST_HEAD(&device->req_list);
80+ INIT_WORK(&device->mcast_work, rndis_set_multicast);
7981
8082 device->state = RNDIS_DEV_UNINITIALIZED;
8183
@@ -815,7 +817,8 @@ static int rndis_filter_query_link_speed(struct rndis_device *dev) · 733 unmodified lines
815817 return ret;
816818 }
817819
818−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
820+static int rndis_filter_set_packet_filter(struct rndis_device *dev,
821+ u32 new_filter)
819822 {
820823 struct rndis_request *request;
821824 struct rndis_set_request *set;
@@ -846,6 +849,28 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) · 24 unmodified lines
846849 return ret;
847850 }
848851
852+static void rndis_set_multicast(struct work_struct *w)
853+{
854+ struct rndis_device *rdev
855+ = container_of(w, struct rndis_device, mcast_work);
856+
857+ if (rdev->ndev->flags & IFF_PROMISC)
858+ rndis_filter_set_packet_filter(rdev,
859+ NDIS_PACKET_TYPE_PROMISCUOUS);
860+ else
861+ rndis_filter_set_packet_filter(rdev,
862+ NDIS_PACKET_TYPE_BROADCAST |
863+ NDIS_PACKET_TYPE_ALL_MULTICAST |
864+ NDIS_PACKET_TYPE_DIRECTED);
865+}
866+
867+void rndis_filter_update(struct netvsc_device *nvdev)
868+{
869+ struct rndis_device *rdev = nvdev->extension;
870+
871+ schedule_work(&rdev->mcast_work);
872+}
873+
849874 static int rndis_filter_init_device(struct rndis_device *dev)
850875 {
851876 struct rndis_request *request;
@@ -973,6 +998,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) · 121 unmodified lines
973998 if (dev->state != RNDIS_DEV_DATAINITIALIZED)
974999 return 0;
9751000
1001+ /* Make sure rndis_set_multicast doesn't re-enable filter! */
1002+ cancel_work_sync(&dev->mcast_work);
1003+
9761004 ret = rndis_filter_set_packet_filter(dev, 0);
9771005 if (ret == -ENODEV)
9781006 ret = 0;
drivers/net/ifb.c+2−2
@@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_device *dev) · 206 unmodified lines
207207 __skb_queue_purge(&txp->tq);
208208 }
209209 kfree(dp->tx_private);
210− free_netdev(dev);
211210 }
212211
213212 static void ifb_setup(struct net_device *dev)
@@ -230,7 +229,8 @@ static void ifb_setup(struct net_device *dev) · 16 unmodified lines
230229 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
231230 netif_keep_dst(dev);
232231 eth_hw_addr_random(dev);
233− dev->destructor = ifb_dev_free;
232+ dev->needs_free_netdev = true;
233+ dev->priv_destructor = ifb_dev_free;
234234 }
235235
236236 static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
drivers/net/ipvlan/ipvlan_main.c+1−1
@@ -632,7 +632,7 @@ void ipvlan_link_setup(struct net_device *dev) · 631 unmodified lines
632632 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
633633 dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE;
634634 dev->netdev_ops = &ipvlan_netdev_ops;
635− dev->destructor = free_netdev;
635+ dev->needs_free_netdev = true;
636636 dev->header_ops = &ipvlan_header_ops;
637637 dev->ethtool_ops = &ipvlan_ethtool_ops;
638638 }
drivers/net/loopback.c+2−2
@@ -159,7 +159,6 @@ static void loopback_dev_free(struct net_device *dev) · 158 unmodified lines
159159 {
160160 dev_net(dev)->loopback_dev = NULL;
161161 free_percpu(dev->lstats);
162− free_netdev(dev);
163162 }
164163
165164 static const struct net_device_ops loopback_ops = {
@@ -196,7 +195,8 @@ static void loopback_setup(struct net_device *dev) · 30 unmodified lines
196195 dev->ethtool_ops = &loopback_ethtool_ops;
197196 dev->header_ops = &eth_header_ops;
198197 dev->netdev_ops = &loopback_ops;
199− dev->destructor = loopback_dev_free;
198+ dev->needs_free_netdev = true;
199+ dev->priv_destructor = loopback_dev_free;
200200 }
201201
202202 /* Setup and register the loopback device. */
drivers/net/macsec.c+2−2
@@ -2996,7 +2996,6 @@ static void macsec_free_netdev(struct net_device *dev) · 2995 unmodified lines
29962996 free_percpu(macsec->secy.tx_sc.stats);
29972997
29982998 dev_put(real_dev);
2999− free_netdev(dev);
30002999 }
30013000
30023001 static void macsec_setup(struct net_device *dev)
@@ -3006,7 +3005,8 @@ static void macsec_setup(struct net_device *dev) · 3 unmodified lines
30063005 dev->max_mtu = ETH_MAX_MTU;
30073006 dev->priv_flags |= IFF_NO_QUEUE;
30083007 dev->netdev_ops = &macsec_netdev_ops;
3009− dev->destructor = macsec_free_netdev;
3008+ dev->needs_free_netdev = true;
3009+ dev->priv_destructor = macsec_free_netdev;
30103010 SET_NETDEV_DEVTYPE(dev, &macsec_type);
30113011
30123012 eth_zero_addr(dev->broadcast);
drivers/net/macvlan.c+1−1
@@ -1090,7 +1090,7 @@ void macvlan_common_setup(struct net_device *dev) · 1089 unmodified lines
10901090 netif_keep_dst(dev);
10911091 dev->priv_flags |= IFF_UNICAST_FLT;
10921092 dev->netdev_ops = &macvlan_netdev_ops;
1093− dev->destructor = free_netdev;
1093+ dev->needs_free_netdev = true;
10941094 dev->header_ops = &macvlan_hard_header_ops;
10951095 dev->ethtool_ops = &macvlan_ethtool_ops;
10961096 }
drivers/net/netconsole.c+1−1
@@ -358,7 +358,7 @@ static ssize_t enabled_store(struct config_item *item, · 357 unmodified lines
358358 if (err)
359359 goto out_unlock;
360360
361− pr_info("netconsole: network logging started\n");
361+ pr_info("network logging started\n");
362362 } else { /* false */
363363 /* We need to disable the netconsole before cleaning it up
364364 * otherwise we might end up in write_msg() with
drivers/net/nlmon.c+1−1
@@ -113,7 +113,7 @@ static void nlmon_setup(struct net_device *dev) · 112 unmodified lines
113113
114114 dev->netdev_ops = &nlmon_ops;
115115 dev->ethtool_ops = &nlmon_ethtool_ops;
116− dev->destructor = free_netdev;
116+ dev->needs_free_netdev = true;
117117
118118 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
119119 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/phy/Kconfig+1−0
@@ -127,6 +127,7 @@ config MDIO_THUNDER · 126 unmodified lines
127127 tristate "ThunderX SOCs MDIO buses"
128128 depends on 64BIT
129129 depends on PCI
130+ depends on !(MDIO_DEVICE=y && PHYLIB=m)
130131 select MDIO_CAVIUM
131132 help
132133 This driver supports the MDIO interfaces found on Cavium
drivers/net/phy/phy.c+2−0
@@ -54,6 +54,8 @@ static const char *phy_speed_to_str(int speed) · 53 unmodified lines
5454 return "5Gbps";
5555 case SPEED_10000:
5656 return "10Gbps";
57+ case SPEED_14000:
58+ return "14Gbps";
5759 case SPEED_20000:
5860 return "20Gbps";
5961 case SPEED_25000:
drivers/net/slip/slip.c+3−4
@@ -629,7 +629,7 @@ static void sl_uninit(struct net_device *dev) · 628 unmodified lines
629629 static void sl_free_netdev(struct net_device *dev)
630630 {
631631 int i = dev->base_addr;
632− free_netdev(dev);
632+
633633 slip_devs[i] = NULL;
634634 }
635635
@@ -651,7 +651,8 @@ static const struct net_device_ops sl_netdev_ops = { · 15 unmodified lines
651651 static void sl_setup(struct net_device *dev)
652652 {
653653 dev->netdev_ops = &sl_netdev_ops;
654− dev->destructor = sl_free_netdev;
654+ dev->needs_free_netdev = true;
655+ dev->priv_destructor = sl_free_netdev;
655656
656657 dev->hard_header_len = 0;
657658 dev->addr_len = 0;
@@ -1369,8 +1370,6 @@ static void __exit slip_exit(void) · 711 unmodified lines
13691370 if (sl->tty) {
13701371 printk(KERN_ERR "%s: tty discipline still running\n",
13711372 dev->name);
1372− /* Intentionally leak the control block. */
1373− dev->destructor = NULL;
13741373 }
13751374
13761375 unregister_netdev(dev);
drivers/net/team/team.c+2−2
@@ -1643,7 +1643,6 @@ static void team_destructor(struct net_device *dev) · 1642 unmodified lines
16431643 struct team *team = netdev_priv(dev);
16441644
16451645 free_percpu(team->pcpu_stats);
1646− free_netdev(dev);
16471646 }
16481647
16491648 static int team_open(struct net_device *dev)
@@ -2073,7 +2072,8 @@ static void team_setup(struct net_device *dev) · 423 unmodified lines
20732072
20742073 dev->netdev_ops = &team_netdev_ops;
20752074 dev->ethtool_ops = &team_ethtool_ops;
2076− dev->destructor = team_destructor;
2075+ dev->needs_free_netdev = true;
2076+ dev->priv_destructor = team_destructor;
20772077 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
20782078 dev->priv_flags |= IFF_NO_QUEUE;
20792079 dev->priv_flags |= IFF_TEAM;
drivers/net/tun.c+2−2
@@ -1561,7 +1561,6 @@ static void tun_free_netdev(struct net_device *dev) · 1560 unmodified lines
15611561 free_percpu(tun->pcpu_stats);
15621562 tun_flow_uninit(tun);
15631563 security_tun_dev_free_security(tun->security);
1564− free_netdev(dev);
15651564 }
15661565
15671566 static void tun_setup(struct net_device *dev)
@@ -1572,7 +1571,8 @@ static void tun_setup(struct net_device *dev) · 4 unmodified lines
15721571 tun->group = INVALID_GID;
15731572
15741573 dev->ethtool_ops = &tun_ethtool_ops;
1575− dev->destructor = tun_free_netdev;
1574+ dev->needs_free_netdev = true;
1575+ dev->priv_destructor = tun_free_netdev;
15761576 /* We prefer our own queue length */
15771577 dev->tx_queue_len = TUN_READQ_SIZE;
15781578 }
drivers/net/usb/cdc-phonet.c+1−1
@@ -298,7 +298,7 @@ static void usbpn_setup(struct net_device *dev) · 297 unmodified lines
298298 dev->addr_len = 1;
299299 dev->tx_queue_len = 3;
300300
301− dev->destructor = free_netdev;
301+ dev->needs_free_netdev = true;
302302 }
303303
304304 /*
drivers/net/usb/qmi_wwan.c+5−1
@@ -123,7 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines
123123 dev->addr_len = 0;
124124 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
125125 dev->netdev_ops = &qmimux_netdev_ops;
126− dev->destructor = free_netdev;
126+ dev->needs_free_netdev = true;
127127 }
128128
129129 static struct net_device *qmimux_find_dev(struct usbnet *dev, u8 mux_id)
@@ -1192,6 +1192,8 @@ static const struct usb_device_id products[] = { · 1062 unmodified lines
11921192 {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */
11931193 {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
11941194 {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
1195+ {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */
1196+ {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */
11951197 {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
11961198 {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
11971199 {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
@@ -1206,6 +1208,8 @@ static const struct usb_device_id products[] = { · 8 unmodified lines
12061208 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
12071209 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
12081210 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
1211+ {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */
1212+ {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */
12091213 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
12101214 {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */
12111215 {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
drivers/net/usb/r8152.c+2−0
@@ -4454,6 +4454,8 @@ static u8 rtl_get_version(struct usb_interface *intf) · 4453 unmodified lines
44544454 break;
44554455 }
44564456
4457+ dev_dbg(&intf->dev, "Detected version 0x%04x\n", version);
4458+
44574459 return version;
44584460 }
44594461
drivers/net/veth.c+2−2
@@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev) · 221 unmodified lines
222222 static void veth_dev_free(struct net_device *dev)
223223 {
224224 free_percpu(dev->vstats);
225− free_netdev(dev);
226225 }
227226
228227 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev) · 88 unmodified lines
317316 NETIF_F_HW_VLAN_STAG_TX |
318317 NETIF_F_HW_VLAN_CTAG_RX |
319318 NETIF_F_HW_VLAN_STAG_RX);
320− dev->destructor = veth_dev_free;
319+ dev->needs_free_netdev = true;
320+ dev->priv_destructor = veth_dev_free;
321321 dev->max_mtu = ETH_MAX_MTU;
322322
323323 dev->hw_features = VETH_FEATURES;
drivers/net/vrf.c+33−5
@@ -36,12 +36,14 @@ · 35 unmodified lines
3636 #include <net/addrconf.h>
3737 #include <net/l3mdev.h>
3838 #include <net/fib_rules.h>
39+#include <net/netns/generic.h>
3940
4041 #define DRV_NAME "vrf"
4142 #define DRV_VERSION "1.0"
4243
4344 #define FIB_RULE_PREF 1000 /* default preference for FIB rules */
44−static bool add_fib_rules = true;
45+
46+static unsigned int vrf_net_id;
4547
4648 struct net_vrf {
4749 struct rtable __rcu *rth;
@@ -1348,7 +1350,7 @@ static void vrf_setup(struct net_device *dev) · 1300 unmodified lines
13481350 dev->netdev_ops = &vrf_netdev_ops;
13491351 dev->l3mdev_ops = &vrf_l3mdev_ops;
13501352 dev->ethtool_ops = &vrf_ethtool_ops;
1351− dev->destructor = free_netdev;
1353+ dev->needs_free_netdev = true;
13521354
13531355 /* Fill in device structure with ethernet-generic values. */
13541356 eth_hw_addr_random(dev);
@@ -1394,6 +1396,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 39 unmodified lines
13941396 struct nlattr *tb[], struct nlattr *data[])
13951397 {
13961398 struct net_vrf *vrf = netdev_priv(dev);
1399+ bool *add_fib_rules;
1400+ struct net *net;
13971401 int err;
13981402
13991403 if (!data || !data[IFLA_VRF_TABLE])
@@ -1409,13 +1413,15 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 9 unmodified lines
14091413 if (err)
14101414 goto out;
14111415
1412− if (add_fib_rules) {
1416+ net = dev_net(dev);
1417+ add_fib_rules = net_generic(net, vrf_net_id);
1418+ if (*add_fib_rules) {
14131419 err = vrf_add_fib_rules(dev);
14141420 if (err) {
14151421 unregister_netdevice(dev);
14161422 goto out;
14171423 }
1418− add_fib_rules = false;
1424+ *add_fib_rules = false;
14191425 }
14201426
14211427 out:
@@ -1498,16 +1504,38 @@ static struct notifier_block vrf_notifier_block __read_mostly = { · 76 unmodified lines
14981504 .notifier_call = vrf_device_event,
14991505 };
15001506
1507+/* Initialize per network namespace state */
1508+static int __net_init vrf_netns_init(struct net *net)
1509+{
1510+ bool *add_fib_rules = net_generic(net, vrf_net_id);
1511+
1512+ *add_fib_rules = true;
1513+
1514+ return 0;
1515+}
1516+
1517+static struct pernet_operations vrf_net_ops __net_initdata = {
1518+ .init = vrf_netns_init,
1519+ .id = &vrf_net_id,
1520+ .size = sizeof(bool),
1521+};
1522+
15011523 static int __init vrf_init_module(void)
15021524 {
15031525 int rc;
15041526
15051527 register_netdevice_notifier(&vrf_notifier_block);
15061528
1507− rc = rtnl_link_register(&vrf_link_ops);
1529+ rc = register_pernet_subsys(&vrf_net_ops);
15081530 if (rc < 0)
15091531 goto error;
15101532
1533+ rc = rtnl_link_register(&vrf_link_ops);
1534+ if (rc < 0) {
1535+ unregister_pernet_subsys(&vrf_net_ops);
1536+ goto error;
1537+ }
1538+
15111539 return 0;
15121540
15131541 error:
drivers/net/vsockmon.c+1−1
@@ -135,7 +135,7 @@ static void vsockmon_setup(struct net_device *dev) · 134 unmodified lines
135135
136136 dev->netdev_ops = &vsockmon_ops;
137137 dev->ethtool_ops = &vsockmon_ethtool_ops;
138− dev->destructor = free_netdev;
138+ dev->needs_free_netdev = true;
139139
140140 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
141141 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/vxlan.c+1−1
@@ -2611,7 +2611,7 @@ static void vxlan_setup(struct net_device *dev) · 2610 unmodified lines
26112611 eth_hw_addr_random(dev);
26122612 ether_setup(dev);
26132613
2614− dev->destructor = free_netdev;
2614+ dev->needs_free_netdev = true;
26152615 SET_NETDEV_DEVTYPE(dev, &vxlan_type);
26162616
26172617 dev->features |= NETIF_F_LLTX;
drivers/net/wan/dlci.c+1−1
@@ -475,7 +475,7 @@ static void dlci_setup(struct net_device *dev) · 474 unmodified lines
475475 dev->flags = 0;
476476 dev->header_ops = &dlci_header_ops;
477477 dev->netdev_ops = &dlci_netdev_ops;
478− dev->destructor = free_netdev;
478+ dev->needs_free_netdev = true;
479479
480480 dlp->receive = dlci_receive;
481481
drivers/net/wan/hdlc_fr.c+1−1
@@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 1105 unmodified lines
11061106 return -EIO;
11071107 }
11081108
1109− dev->destructor = free_netdev;
1109+ dev->needs_free_netdev = true;
11101110 *get_dev_p(pvc, type) = dev;
11111111 if (!used) {
11121112 state(hdlc)->dce_changed = 1;
drivers/net/wan/lapbether.c+1−1
@@ -306,7 +306,7 @@ static const struct net_device_ops lapbeth_netdev_ops = { · 305 unmodified lines
306306 static void lapbeth_setup(struct net_device *dev)
307307 {
308308 dev->netdev_ops = &lapbeth_netdev_ops;
309− dev->destructor = free_netdev;
309+ dev->needs_free_netdev = true;
310310 dev->type = ARPHRD_X25;
311311 dev->hard_header_len = 3;
312312 dev->mtu = 1000;
drivers/net/wireless/ath/ath6kl/main.c+1−1
@@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev) · 1286 unmodified lines
12871287 struct ath6kl *ar = ath6kl_priv(dev);
12881288
12891289 dev->netdev_ops = &ath6kl_netdev_ops;
1290− dev->destructor = free_netdev;
1290+ dev->needs_free_netdev = true;
12911291 dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
12921292
12931293 dev->needed_headroom = ETH_HLEN;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+0−1
@@ -5222,7 +5222,6 @@ void brcmf_cfg80211_free_netdev(struct net_device *ndev) · 5221 unmodified lines
52225222
52235223 if (vif)
52245224 brcmf_free_vif(vif);
5225− free_netdev(ndev);
52265225 }
52275226
52285227 static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c+2−1
@@ -624,7 +624,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, · 623 unmodified lines
624624 if (!ndev)
625625 return ERR_PTR(-ENOMEM);
626626
627− ndev->destructor = brcmf_cfg80211_free_netdev;
627+ ndev->needs_free_netdev = true;
628+ ndev->priv_destructor = brcmf_cfg80211_free_netdev;
628629 ifp = netdev_priv(ndev);
629630 ifp->ndev = ndev;
630631 /* store mapping ifidx to bsscfgidx */
drivers/net/wireless/intersil/hostap/hostap_main.c+1−1
@@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local, · 72 unmodified lines
7373 dev->mem_end = mdev->mem_end;
7474
7575 hostap_setup_dev(dev, local, type);
76− dev->destructor = free_netdev;
76+ dev->needs_free_netdev = true;
7777
7878 sprintf(dev->name, "%s%s", prefix, name);
7979 if (!rtnl_locked)
drivers/net/wireless/mac80211_hwsim.c+1−1
@@ -2861,7 +2861,7 @@ static const struct net_device_ops hwsim_netdev_ops = { · 2860 unmodified lines
28612861 static void hwsim_mon_setup(struct net_device *dev)
28622862 {
28632863 dev->netdev_ops = &hwsim_netdev_ops;
2864− dev->destructor = free_netdev;
2864+ dev->needs_free_netdev = true;
28652865 ether_setup(dev);
28662866 dev->priv_flags |= IFF_NO_QUEUE;
28672867 dev->type = ARPHRD_IEEE80211_RADIOTAP;
drivers/net/wireless/marvell/mwifiex/main.c+1−1
@@ -1284,7 +1284,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, · 1283 unmodified lines
12841284 struct net_device *dev)
12851285 {
12861286 dev->netdev_ops = &mwifiex_netdev_ops;
1287− dev->destructor = free_netdev;
1287+ dev->needs_free_netdev = true;
12881288 /* Initialize private structure */
12891289 priv->current_key_index = 0;
12901290 priv->media_connected = false;
drivers/net/wireless/quantenna/qtnfmac/core.c+1−1
@@ -316,7 +316,7 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, · 315 unmodified lines
316316 vif->netdev = dev;
317317
318318 dev->netdev_ops = &qtnf_netdev_ops;
319− dev->destructor = free_netdev;
319+ dev->needs_free_netdev = true;
320320 dev_net_set(dev, wiphy_net(wiphy));
321321 dev->ieee80211_ptr = &vif->wdev;
322322 dev->ieee80211_ptr->iftype = iftype;
drivers/nvme/host/core.c+14−7
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(max_retries, "max number of retries a command may have"); · 55 unmodified lines
5656 static int nvme_char_major;
5757 module_param(nvme_char_major, int, 0);
5858
59−static unsigned long default_ps_max_latency_us = 25000;
59+static unsigned long default_ps_max_latency_us = 100000;
6060 module_param(default_ps_max_latency_us, ulong, 0644);
6161 MODULE_PARM_DESC(default_ps_max_latency_us,
6262 "max power saving latency for new devices; use PM QOS to change per device");
@@ -1342,7 +1342,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 1279 unmodified lines
13421342 * transitioning between power states. Therefore, when running
13431343 * in any given state, we will enter the next lower-power
13441344 * non-operational state after waiting 50 * (enlat + exlat)
1345− * microseconds, as long as that state's total latency is under
1345+ * microseconds, as long as that state's exit latency is under
13461346 * the requested maximum latency.
13471347 *
13481348 * We will not autonomously enter any non-operational state for
@@ -1387,7 +1387,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 38 unmodified lines
13871387 * lowest-power state, not the number of states.
13881388 */
13891389 for (state = (int)ctrl->npss; state >= 0; state--) {
1390− u64 total_latency_us, transition_ms;
1390+ u64 total_latency_us, exit_latency_us, transition_ms;
13911391
13921392 if (target)
13931393 table->entries[state] = target;
@@ -1408,12 +1408,15 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 14 unmodified lines
14081408 NVME_PS_FLAGS_NON_OP_STATE))
14091409 continue;
14101410
1411− total_latency_us =
1412− (u64)le32_to_cpu(ctrl->psd[state].entry_lat) +
1413− + le32_to_cpu(ctrl->psd[state].exit_lat);
1414− if (total_latency_us > ctrl->ps_max_latency_us)
1411+ exit_latency_us =
1412+ (u64)le32_to_cpu(ctrl->psd[state].exit_lat);
1413+ if (exit_latency_us > ctrl->ps_max_latency_us)
14151414 continue;
14161415
1416+ total_latency_us =
1417+ exit_latency_us +
1418+ le32_to_cpu(ctrl->psd[state].entry_lat);
1419+
14171420 /*
14181421 * This state is good. Use it as the APST idle
14191422 * target for higher power states.
@@ -2438,6 +2441,10 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl) · 1018 unmodified lines
24382441 struct nvme_ns *ns;
24392442
24402443 mutex_lock(&ctrl->namespaces_mutex);
2444+
2445+ /* Forcibly start all queues to avoid having stuck requests */
2446+ blk_mq_start_hw_queues(ctrl->admin_q);
2447+
24412448 list_for_each_entry(ns, &ctrl->namespaces, list) {
24422449 /*
24432450 * Revalidating a dead namespace sets capacity to 0. This will
drivers/nvme/host/fc.c+18−2
@@ -1139,6 +1139,7 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) · 1138 unmodified lines
11391139 /* *********************** NVME Ctrl Routines **************************** */
11401140
11411141 static void __nvme_fc_final_op_cleanup(struct request *rq);
1142+static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
11421143
11431144 static int
11441145 nvme_fc_reinit_request(void *data, struct request *rq)
@@ -1265,7 +1266,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 120 unmodified lines
12651266 struct nvme_command *sqe = &op->cmd_iu.sqe;
12661267 __le16 status = cpu_to_le16(NVME_SC_SUCCESS << 1);
12671268 union nvme_result result;
1268− bool complete_rq;
1269+ bool complete_rq, terminate_assoc = true;
12691270
12701271 /*
12711272 * WARNING:
@@ -1294,6 +1295,14 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 22 unmodified lines
12941295 * fabricate a CQE, the following fields will not be set as they
12951296 * are not referenced:
12961297 * cqe.sqid, cqe.sqhd, cqe.command_id
1298+ *
1299+ * Failure or error of an individual i/o, in a transport
1300+ * detected fashion unrelated to the nvme completion status,
1301+ * potentially cause the initiator and target sides to get out
1302+ * of sync on SQ head/tail (aka outstanding io count allowed).
1303+ * Per FC-NVME spec, failure of an individual command requires
1304+ * the connection to be terminated, which in turn requires the
1305+ * association to be terminated.
12971306 */
12981307
12991308 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma,
@@ -1359,6 +1368,8 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 59 unmodified lines
13591368 goto done;
13601369 }
13611370
1371+ terminate_assoc = false;
1372+
13621373 done:
13631374 if (op->flags & FCOP_FLAGS_AEN) {
13641375 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result);
@@ -1366,7 +1377,7 @@ done: · 1 unmodified line
13661377 atomic_set(&op->state, FCPOP_STATE_IDLE);
13671378 op->flags = FCOP_FLAGS_AEN; /* clear other flags */
13681379 nvme_fc_ctrl_put(ctrl);
1369− return;
1380+ goto check_error;
13701381 }
13711382
13721383 complete_rq = __nvme_fc_fcpop_chk_teardowns(ctrl, op);
@@ -1379,6 +1390,10 @@ done: · 6 unmodified lines
13791390 nvme_end_request(rq, status, result);
13801391 } else
13811392 __nvme_fc_final_op_cleanup(rq);
1393+
1394+check_error:
1395+ if (terminate_assoc)
1396+ nvme_fc_error_recovery(ctrl, "transport detected io error");
13821397 }
13831398
13841399 static int
@@ -2791,6 +2806,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 1406 unmodified lines
27912806 ctrl->ctrl.opts = NULL;
27922807 /* initiate nvme ctrl ref counting teardown */
27932808 nvme_uninit_ctrl(&ctrl->ctrl);
2809+ nvme_put_ctrl(&ctrl->ctrl);
27942810
27952811 /* as we're past the point where we transition to the ref
27962812 * counting teardown path, if we return a bad pointer here,
drivers/nvme/host/pci.c+6−7
@@ -1367,7 +1367,7 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) · 1366 unmodified lines
13671367 bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO);
13681368
13691369 /* If there is a reset ongoing, we shouldn't reset again. */
1370− if (work_busy(&dev->reset_work))
1370+ if (dev->ctrl.state == NVME_CTRL_RESETTING)
13711371 return false;
13721372
13731373 /* We shouldn't reset unless the controller is on fatal error state
@@ -1903,7 +1903,7 @@ static void nvme_reset_work(struct work_struct *work) · 529 unmodified lines
19031903 bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
19041904 int result = -ENODEV;
19051905
1906− if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
1906+ if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING))
19071907 goto out;
19081908
19091909 /*
@@ -1913,9 +1913,6 @@ static void nvme_reset_work(struct work_struct *work) · 3 unmodified lines
19131913 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
19141914 nvme_dev_disable(dev, false);
19151915
1916− if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING))
1917− goto out;
1918−
19191916 result = nvme_pci_enable(dev);
19201917 if (result)
19211918 goto out;
@@ -2009,8 +2006,8 @@ static int nvme_reset(struct nvme_dev *dev) · 87 unmodified lines
20092006 {
20102007 if (!dev->ctrl.admin_q || blk_queue_dying(dev->ctrl.admin_q))
20112008 return -ENODEV;
2012− if (work_busy(&dev->reset_work))
2013− return -ENODEV;
2009+ if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING))
2010+ return -EBUSY;
20142011 if (!queue_work(nvme_workq, &dev->reset_work))
20152012 return -EBUSY;
20162013 return 0;
@@ -2136,6 +2133,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 119 unmodified lines
21362133 if (result)
21372134 goto release_pools;
21382135
2136+ nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING);
21392137 dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
21402138
21412139 queue_work(nvme_workq, &dev->reset_work);
@@ -2179,6 +2177,7 @@ static void nvme_remove(struct pci_dev *pdev) · 37 unmodified lines
21792177
21802178 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
21812179
2180+ cancel_work_sync(&dev->reset_work);
21822181 pci_set_drvdata(pdev, NULL);
21832182
21842183 if (!pci_device_is_present(pdev)) {
drivers/nvme/host/rdma.c+29−15
@@ -753,28 +753,26 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 752 unmodified lines
753753 if (ret)
754754 goto requeue;
755755
756− blk_mq_start_stopped_hw_queues(ctrl->ctrl.admin_q, true);
757−
758756 ret = nvmf_connect_admin_queue(&ctrl->ctrl);
759757 if (ret)
760− goto stop_admin_q;
758+ goto requeue;
761759
762760 set_bit(NVME_RDMA_Q_LIVE, &ctrl->queues[0].flags);
763761
764762 ret = nvme_enable_ctrl(&ctrl->ctrl, ctrl->cap);
765763 if (ret)
766− goto stop_admin_q;
764+ goto requeue;
767765
768766 nvme_start_keep_alive(&ctrl->ctrl);
769767
770768 if (ctrl->queue_count > 1) {
771769 ret = nvme_rdma_init_io_queues(ctrl);
772770 if (ret)
773− goto stop_admin_q;
771+ goto requeue;
774772
775773 ret = nvme_rdma_connect_io_queues(ctrl);
776774 if (ret)
777− goto stop_admin_q;
775+ goto requeue;
778776 }
779777
780778 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
@@ -782,7 +780,6 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 1 unmodified line
782780 ctrl->ctrl.opts->nr_reconnects = 0;
783781
784782 if (ctrl->queue_count > 1) {
785− nvme_start_queues(&ctrl->ctrl);
786783 nvme_queue_scan(&ctrl->ctrl);
787784 nvme_queue_async_events(&ctrl->ctrl);
788785 }
@@ -791,8 +788,6 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 2 unmodified lines
791788
792789 return;
793790
794−stop_admin_q:
795− blk_mq_stop_hw_queues(ctrl->ctrl.admin_q);
796791 requeue:
797792 dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n",
798793 ctrl->ctrl.opts->nr_reconnects);
@@ -823,6 +818,13 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) · 24 unmodified lines
823818 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
824819 nvme_cancel_request, &ctrl->ctrl);
825820
821+ /*
822+ * queues are not a live anymore, so restart the queues to fail fast
823+ * new IO
824+ */
825+ blk_mq_start_stopped_hw_queues(ctrl->ctrl.admin_q, true);
826+ nvme_start_queues(&ctrl->ctrl);
827+
826828 nvme_rdma_reconnect_or_remove(ctrl);
827829 }
828830
@@ -1433,7 +1435,7 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 604 unmodified lines
14331435 /*
14341436 * We cannot accept any other command until the Connect command has completed.
14351437 */
1436−static inline bool nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue,
1438+static inline int nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue,
14371439 struct request *rq)
14381440 {
14391441 if (unlikely(!test_bit(NVME_RDMA_Q_LIVE, &queue->flags))) {
@@ -1441,11 +1443,22 @@ static inline bool nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, · 1 unmodified line
14411443
14421444 if (!blk_rq_is_passthrough(rq) ||
14431445 cmd->common.opcode != nvme_fabrics_command ||
1444− cmd->fabrics.fctype != nvme_fabrics_type_connect)
1445− return false;
1446+ cmd->fabrics.fctype != nvme_fabrics_type_connect) {
1447+ /*
1448+ * reconnecting state means transport disruption, which
1449+ * can take a long time and even might fail permanently,
1450+ * so we can't let incoming I/O be requeued forever.
1451+ * fail it fast to allow upper layers a chance to
1452+ * failover.
1453+ */
1454+ if (queue->ctrl->ctrl.state == NVME_CTRL_RECONNECTING)
1455+ return -EIO;
1456+ else
1457+ return -EAGAIN;
1458+ }
14461459 }
14471460
1448− return true;
1461+ return 0;
14491462 }
14501463
14511464 static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
@@ -1463,8 +1476,9 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, · 11 unmodified lines
14631476
14641477 WARN_ON_ONCE(rq->tag < 0);
14651478
1466− if (!nvme_rdma_queue_is_ready(queue, rq))
1467− return BLK_MQ_RQ_QUEUE_BUSY;
1479+ ret = nvme_rdma_queue_is_ready(queue, rq);
1480+ if (unlikely(ret))
1481+ goto err;
14681482
14691483 dev = queue->device->dev;
14701484 ib_dma_sync_single_for_cpu(dev, sqe->dma,
drivers/of/device.c+2−2
@@ -144,8 +144,8 @@ int of_dma_configure(struct device *dev, struct device_node *np) · 143 unmodified lines
144144 coherent ? " " : " not ");
145145
146146 iommu = of_iommu_configure(dev, np);
147− if (IS_ERR(iommu))
148− return PTR_ERR(iommu);
147+ if (IS_ERR(iommu) && PTR_ERR(iommu) == -EPROBE_DEFER)
148+ return -EPROBE_DEFER;
149149
150150 dev_dbg(dev, "device is%sbehind an iommu\n",
151151 iommu ? " " : " not ");
drivers/phy/phy-qcom-qmp.c+7−7
@@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev) · 843 unmodified lines
844844 int num = qmp->cfg->num_vregs;
845845 int i;
846846
847− qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
847+ qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
848848 if (!qmp->vregs)
849849 return -ENOMEM;
850850
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id) · 132 unmodified lines
983983 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
984984 */
985985 qphy->tx = of_iomap(np, 0);
986− if (IS_ERR(qphy->tx))
987− return PTR_ERR(qphy->tx);
986+ if (!qphy->tx)
987+ return -ENOMEM;
988988
989989 qphy->rx = of_iomap(np, 1);
990− if (IS_ERR(qphy->rx))
991− return PTR_ERR(qphy->rx);
990+ if (!qphy->rx)
991+ return -ENOMEM;
992992
993993 qphy->pcs = of_iomap(np, 2);
994− if (IS_ERR(qphy->pcs))
995− return PTR_ERR(qphy->pcs);
994+ if (!qphy->pcs)
995+ return -ENOMEM;
996996
997997 /*
998998 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
drivers/platform/goldfish/goldfish_pipe.c+1−1
@@ -704,7 +704,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev) · 703 unmodified lines
704704 /* Reallocate the array */
705705 u32 new_capacity = 2 * dev->pipes_capacity;
706706 struct goldfish_pipe **pipes =
707− kcalloc(new_capacity, sizeof(*pipes), GFP_KERNEL);
707+ kcalloc(new_capacity, sizeof(*pipes), GFP_ATOMIC);
708708 if (!pipes)
709709 return -ENOMEM;
710710 memcpy(pipes, dev->pipes, sizeof(*pipes) * dev->pipes_capacity);
drivers/reset/hisilicon/hi6220_reset.c+2−0
@@ -155,3 +155,5 @@ static int __init hi6220_reset_init(void) · 154 unmodified lines
155155 }
156156
157157 postcore_initcall(hi6220_reset_init);
158+
159+MODULE_LICENSE("GPL v2");
drivers/s390/cio/vfio_ccw_ops.c+6−6
@@ -70,14 +70,14 @@ static ssize_t name_show(struct kobject *kobj, struct device *dev, char *buf) · 69 unmodified lines
7070 {
7171 return sprintf(buf, "I/O subchannel (Non-QDIO)\n");
7272 }
73−MDEV_TYPE_ATTR_RO(name);
73+static MDEV_TYPE_ATTR_RO(name);
7474
7575 static ssize_t device_api_show(struct kobject *kobj, struct device *dev,
7676 char *buf)
7777 {
7878 return sprintf(buf, "%s\n", VFIO_DEVICE_API_CCW_STRING);
7979 }
80−MDEV_TYPE_ATTR_RO(device_api);
80+static MDEV_TYPE_ATTR_RO(device_api);
8181
8282 static ssize_t available_instances_show(struct kobject *kobj,
8383 struct device *dev, char *buf)
@@ -86,7 +86,7 @@ static ssize_t available_instances_show(struct kobject *kobj, · 2 unmodified lines
8686
8787 return sprintf(buf, "%d\n", atomic_read(&private->avail));
8888 }
89−MDEV_TYPE_ATTR_RO(available_instances);
89+static MDEV_TYPE_ATTR_RO(available_instances);
9090
9191 static struct attribute *mdev_types_attrs[] = {
9292 &mdev_type_attr_name.attr,
@@ -100,7 +100,7 @@ static struct attribute_group mdev_type_group = { · 7 unmodified lines
100100 .attrs = mdev_types_attrs,
101101 };
102102
103−struct attribute_group *mdev_type_groups[] = {
103+static struct attribute_group *mdev_type_groups[] = {
104104 &mdev_type_group,
105105 NULL,
106106 };
@@ -152,7 +152,7 @@ static int vfio_ccw_mdev_open(struct mdev_device *mdev) · 45 unmodified lines
152152 &events, &private->nb);
153153 }
154154
155−void vfio_ccw_mdev_release(struct mdev_device *mdev)
155+static void vfio_ccw_mdev_release(struct mdev_device *mdev)
156156 {
157157 struct vfio_ccw_private *private =
158158 dev_get_drvdata(mdev_parent_dev(mdev));
@@ -233,7 +233,7 @@ static int vfio_ccw_mdev_get_region_info(struct vfio_region_info *info, · 74 unmodified lines
233233 }
234234 }
235235
236−int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info)
236+static int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info)
237237 {
238238 if (info->index != VFIO_CCW_IO_IRQ_INDEX)
239239 return -EINVAL;
drivers/s390/crypto/ap_bus.c+24−14
@@ -668,10 +668,28 @@ static int ap_device_probe(struct device *dev) · 667 unmodified lines
668668 struct ap_driver *ap_drv = to_ap_drv(dev->driver);
669669 int rc;
670670
671+ /* Add queue/card to list of active queues/cards */
672+ spin_lock_bh(&ap_list_lock);
673+ if (is_card_dev(dev))
674+ list_add(&to_ap_card(dev)->list, &ap_card_list);
675+ else
676+ list_add(&to_ap_queue(dev)->list,
677+ &to_ap_queue(dev)->card->queues);
678+ spin_unlock_bh(&ap_list_lock);
679+
671680 ap_dev->drv = ap_drv;
672681 rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV;
673− if (rc)
682+
683+ if (rc) {
684+ spin_lock_bh(&ap_list_lock);
685+ if (is_card_dev(dev))
686+ list_del_init(&to_ap_card(dev)->list);
687+ else
688+ list_del_init(&to_ap_queue(dev)->list);
689+ spin_unlock_bh(&ap_list_lock);
674690 ap_dev->drv = NULL;
691+ }
692+
675693 return rc;
676694 }
677695
@@ -680,14 +698,17 @@ static int ap_device_remove(struct device *dev) · 2 unmodified lines
680698 struct ap_device *ap_dev = to_ap_dev(dev);
681699 struct ap_driver *ap_drv = ap_dev->drv;
682700
701+ if (ap_drv->remove)
702+ ap_drv->remove(ap_dev);
703+
704+ /* Remove queue/card from list of active queues/cards */
683705 spin_lock_bh(&ap_list_lock);
684706 if (is_card_dev(dev))
685707 list_del_init(&to_ap_card(dev)->list);
686708 else
687709 list_del_init(&to_ap_queue(dev)->list);
688710 spin_unlock_bh(&ap_list_lock);
689− if (ap_drv->remove)
690− ap_drv->remove(ap_dev);
711+
691712 return 0;
692713 }
693714
@@ -1056,10 +1077,6 @@ static void ap_scan_bus(struct work_struct *unused) · 362 unmodified lines
10561077 }
10571078 /* get it and thus adjust reference counter */
10581079 get_device(&ac->ap_dev.device);
1059− /* Add card device to card list */
1060− spin_lock_bh(&ap_list_lock);
1061− list_add(&ac->list, &ap_card_list);
1062− spin_unlock_bh(&ap_list_lock);
10631080 }
10641081 /* now create the new queue device */
10651082 aq = ap_queue_create(qid, type);
@@ -1070,10 +1087,6 @@ static void ap_scan_bus(struct work_struct *unused) · 4 unmodified lines
10701087 aq->ap_dev.device.parent = &ac->ap_dev.device;
10711088 dev_set_name(&aq->ap_dev.device,
10721089 "%02x.%04x", id, dom);
1073− /* Add queue device to card queue list */
1074− spin_lock_bh(&ap_list_lock);
1075− list_add(&aq->list, &ac->queues);
1076− spin_unlock_bh(&ap_list_lock);
10771090 /* Start with a device reset */
10781091 spin_lock_bh(&aq->lock);
10791092 ap_wait(ap_sm_event(aq, AP_EVENT_POLL));
@@ -1081,9 +1094,6 @@ static void ap_scan_bus(struct work_struct *unused) · 1 unmodified line
10811094 /* Register device */
10821095 rc = device_register(&aq->ap_dev.device);
10831096 if (rc) {
1084− spin_lock_bh(&ap_list_lock);
1085− list_del_init(&aq->list);
1086− spin_unlock_bh(&ap_list_lock);
10871097 put_device(&aq->ap_dev.device);
10881098 continue;
10891099 }
drivers/s390/crypto/ap_card.c+8−1
@@ -160,7 +160,14 @@ static struct device_type ap_card_type = { · 159 unmodified lines
160160
161161 static void ap_card_device_release(struct device *dev)
162162 {
163− kfree(to_ap_card(dev));
163+ struct ap_card *ac = to_ap_card(dev);
164+
165+ if (!list_empty(&ac->list)) {
166+ spin_lock_bh(&ap_list_lock);
167+ list_del_init(&ac->list);
168+ spin_unlock_bh(&ap_list_lock);
169+ }
170+ kfree(ac);
164171 }
165172
166173 struct ap_card *ap_card_create(int id, int queue_depth, int device_type,
drivers/s390/crypto/ap_queue.c+8−1
@@ -584,7 +584,14 @@ static struct device_type ap_queue_type = { · 583 unmodified lines
584584
585585 static void ap_queue_device_release(struct device *dev)
586586 {
587− kfree(to_ap_queue(dev));
587+ struct ap_queue *aq = to_ap_queue(dev);
588+
589+ if (!list_empty(&aq->list)) {
590+ spin_lock_bh(&ap_list_lock);
591+ list_del_init(&aq->list);
592+ spin_unlock_bh(&ap_list_lock);
593+ }
594+ kfree(aq);
588595 }
589596
590597 struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type)
drivers/s390/net/netiucv.c+2−2
@@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struct net_device *dev) · 1953 unmodified lines
19541954 privptr->conn = NULL; privptr->fsm = NULL;
19551955 /* privptr gets freed by free_netdev() */
19561956 }
1957− free_netdev(dev);
19581957 }
19591958
19601959 /**
@@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(struct net_device *dev) · 11 unmodified lines
19721971 dev->mtu = NETIUCV_MTU_DEFAULT;
19731972 dev->min_mtu = 576;
19741973 dev->max_mtu = NETIUCV_MTU_MAX;
1975− dev->destructor = netiucv_free_netdevice;
1974+ dev->needs_free_netdev = true;
1975+ dev->priv_destructor = netiucv_free_netdevice;
19761976 dev->hard_header_len = NETIUCV_HDRLEN;
19771977 dev->addr_len = 0;
19781978 dev->type = ARPHRD_SLIP;
drivers/scsi/bnx2fc/bnx2fc.h+1−0
@@ -191,6 +191,7 @@ struct bnx2fc_hba { · 190 unmodified lines
191191 struct bnx2fc_cmd_mgr *cmd_mgr;
192192 spinlock_t hba_lock;
193193 struct mutex hba_mutex;
194+ struct mutex hba_stats_mutex;
194195 unsigned long adapter_state;
195196 #define ADAPTER_STATE_UP 0
196197 #define ADAPTER_STATE_GOING_DOWN 1
drivers/scsi/bnx2fc/bnx2fc_fcoe.c+8−2
@@ -663,15 +663,17 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost) · 662 unmodified lines
663663 if (!fw_stats)
664664 return NULL;
665665
666+ mutex_lock(&hba->hba_stats_mutex);
667+
666668 bnx2fc_stats = fc_get_host_stats(shost);
667669
668670 init_completion(&hba->stat_req_done);
669671 if (bnx2fc_send_stat_req(hba))
670− return bnx2fc_stats;
672+ goto unlock_stats_mutex;
671673 rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ));
672674 if (!rc) {
673675 BNX2FC_HBA_DBG(lport, "FW stat req timed out\n");
674− return bnx2fc_stats;
676+ goto unlock_stats_mutex;
675677 }
676678 BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt);
677679 bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt;
@@ -693,6 +695,9 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost) · 15 unmodified lines
693695
694696 memcpy(&hba->prev_stats, hba->stats_buffer,
695697 sizeof(struct fcoe_statistics_params));
698+
699+unlock_stats_mutex:
700+ mutex_unlock(&hba->hba_stats_mutex);
696701 return bnx2fc_stats;
697702 }
698703
@@ -1340,6 +1345,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic) · 641 unmodified lines
13401345 }
13411346 spin_lock_init(&hba->hba_lock);
13421347 mutex_init(&hba->hba_mutex);
1348+ mutex_init(&hba->hba_stats_mutex);
13431349
13441350 hba->cnic = cnic;
13451351
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c+0−1
@@ -1597,7 +1597,6 @@ static void release_offload_resources(struct cxgbi_sock *csk) · 1596 unmodified lines
15971597 cxgbi_sock_put(csk);
15981598 }
15991599 csk->dst = NULL;
1600− csk->cdev = NULL;
16011600 }
16021601
16031602 static int init_act_open(struct cxgbi_sock *csk)
drivers/scsi/cxgbi/libcxgbi.c+22−7
@@ -867,7 +867,8 @@ static void need_active_close(struct cxgbi_sock *csk) · 866 unmodified lines
867867 log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n",
868868 csk, (csk)->state, (csk)->flags, (csk)->tid);
869869 spin_lock_bh(&csk->lock);
870− dst_confirm(csk->dst);
870+ if (csk->dst)
871+ dst_confirm(csk->dst);
871872 data_lost = skb_queue_len(&csk->receive_queue);
872873 __skb_queue_purge(&csk->receive_queue);
873874
@@ -882,7 +883,8 @@ static void need_active_close(struct cxgbi_sock *csk) · 8 unmodified lines
882883 }
883884
884885 if (close_req) {
885− if (data_lost)
886+ if (!cxgbi_sock_flag(csk, CTPF_LOGOUT_RSP_RCVD) ||
887+ data_lost)
886888 csk->cdev->csk_send_abort_req(csk);
887889 else
888890 csk->cdev->csk_send_close_req(csk);
@@ -1186,9 +1188,10 @@ static int cxgbi_sock_send_pdus(struct cxgbi_sock *csk, struct sk_buff *skb) · 297 unmodified lines
11861188 cxgbi_ulp_extra_len(cxgbi_skcb_ulp_mode(skb));
11871189 skb = next;
11881190 }
1189−done:
1191+
11901192 if (likely(skb_queue_len(&csk->write_queue)))
11911193 cdev->csk_push_tx_frames(csk, 1);
1194+done:
11921195 spin_unlock_bh(&csk->lock);
11931196 return copied;
11941197
@@ -1568,9 +1571,12 @@ static inline int read_pdu_skb(struct iscsi_conn *conn, · 373 unmodified lines
15681571 }
15691572 }
15701573
1571−static int skb_read_pdu_bhs(struct iscsi_conn *conn, struct sk_buff *skb)
1574+static int
1575+skb_read_pdu_bhs(struct cxgbi_sock *csk, struct iscsi_conn *conn,
1576+ struct sk_buff *skb)
15721577 {
15731578 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
1579+ int err;
15741580
15751581 log_debug(1 << CXGBI_DBG_PDU_RX,
15761582 "conn 0x%p, skb 0x%p, len %u, flag 0x%lx.\n",
@@ -1608,7 +1614,16 @@ static int skb_read_pdu_bhs(struct iscsi_conn *conn, struct sk_buff *skb) · 31 unmodified lines
16081614 }
16091615 }
16101616
1611− return read_pdu_skb(conn, skb, 0, 0);
1617+ err = read_pdu_skb(conn, skb, 0, 0);
1618+ if (likely(err >= 0)) {
1619+ struct iscsi_hdr *hdr = (struct iscsi_hdr *)skb->data;
1620+ u8 opcode = hdr->opcode & ISCSI_OPCODE_MASK;
1621+
1622+ if (unlikely(opcode == ISCSI_OP_LOGOUT_RSP))
1623+ cxgbi_sock_set_flag(csk, CTPF_LOGOUT_RSP_RCVD);
1624+ }
1625+
1626+ return err;
16121627 }
16131628
16141629 static int skb_read_pdu_data(struct iscsi_conn *conn, struct sk_buff *lskb,
@@ -1713,7 +1728,7 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · 98 unmodified lines
17131728 cxgbi_skcb_rx_pdulen(skb));
17141729
17151730 if (cxgbi_skcb_test_flag(skb, SKCBF_RX_COALESCED)) {
1716− err = skb_read_pdu_bhs(conn, skb);
1731+ err = skb_read_pdu_bhs(csk, conn, skb);
17171732 if (err < 0) {
17181733 pr_err("coalesced bhs, csk 0x%p, skb 0x%p,%u, "
17191734 "f 0x%lx, plen %u.\n",
@@ -1731,7 +1746,7 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · 11 unmodified lines
17311746 cxgbi_skcb_flags(skb),
17321747 cxgbi_skcb_rx_pdulen(skb));
17331748 } else {
1734− err = skb_read_pdu_bhs(conn, skb);
1749+ err = skb_read_pdu_bhs(csk, conn, skb);
17351750 if (err < 0) {
17361751 pr_err("bhs, csk 0x%p, skb 0x%p,%u, "
17371752 "f 0x%lx, plen %u.\n",
drivers/scsi/cxgbi/libcxgbi.h+1−0
@@ -187,6 +187,7 @@ enum cxgbi_sock_flags { · 186 unmodified lines
187187 CTPF_HAS_ATID, /* reserved atid */
188188 CTPF_HAS_TID, /* reserved hw tid */
189189 CTPF_OFFLOAD_DOWN, /* offload function off */
190+ CTPF_LOGOUT_RSP_RCVD, /* received logout response */
190191 };
191192
192193 struct cxgbi_skb_rx_cb {
drivers/scsi/lpfc/lpfc_crtn.h+1−1
@@ -127,7 +127,7 @@ int lpfc_disc_state_machine(struct lpfc_vport *, struct lpfc_nodelist *, void *, · 126 unmodified lines
127127 void lpfc_do_scr_ns_plogi(struct lpfc_hba *, struct lpfc_vport *);
128128 int lpfc_check_sparm(struct lpfc_vport *, struct lpfc_nodelist *,
129129 struct serv_parm *, uint32_t, int);
130−int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist *);
130+void lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist *);
131131 void lpfc_more_plogi(struct lpfc_vport *);
132132 void lpfc_more_adisc(struct lpfc_vport *);
133133 void lpfc_end_rscn(struct lpfc_vport *);
drivers/scsi/lpfc/lpfc_ct.c+3−2
@@ -978,9 +978,10 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 977 unmodified lines
978978 ndlp, did, ndlp->nlp_fc4_type,
979979 FC_TYPE_FCP, FC_TYPE_NVME);
980980 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
981+
982+ lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
983+ lpfc_issue_els_prli(vport, ndlp, 0);
981984 }
982− lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
983− lpfc_issue_els_prli(vport, ndlp, 0);
984985 } else
985986 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
986987 "3065 GFT_ID failed x%08x\n", irsp->ulpStatus);
drivers/scsi/lpfc/lpfc_nportdisc.c+5−2
@@ -206,7 +206,7 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 205 unmodified lines
206206 * associated with a LPFC_NODELIST entry. This
207207 * routine effectively results in a "software abort".
208208 */
209−int
209+void
210210 lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
211211 {
212212 LIST_HEAD(abort_list);
@@ -215,6 +215,10 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 2 unmodified lines
215215
216216 pring = lpfc_phba_elsring(phba);
217217
218+ /* In case of error recovery path, we might have a NULL pring here */
219+ if (!pring)
220+ return;
221+
218222 /* Abort outstanding I/O on NPort <nlp_DID> */
219223 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY,
220224 "2819 Abort outstanding I/O on NPort x%x "
@@ -273,7 +277,6 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 52 unmodified lines
273277 IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED);
274278
275279 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp);
276− return 0;
277280 }
278281
279282 static int
drivers/scsi/lpfc/lpfc_nvmet.c+2−2
@@ -799,8 +799,8 @@ lpfc_nvmet_xmt_fcp_release(struct nvmet_fc_target_port *tgtport, · 798 unmodified lines
799799 }
800800 spin_unlock_irqrestore(&ctxp->ctxlock, flags);
801801
802− lpfc_nvmeio_data(phba, "NVMET FCP FREE: xri x%x ste %d\n", ctxp->oxid,
803− ctxp->state, 0);
802+ lpfc_nvmeio_data(phba, "NVMET FCP FREE: xri x%x ste %d abt %d\n", ctxp->oxid,
803+ ctxp->state, aborting);
804804
805805 atomic_inc(&lpfc_nvmep->xmt_fcp_release);
806806
drivers/scsi/qla2xxx/qla_bsg.c+5−4
@@ -730,6 +730,8 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) · 729 unmodified lines
730730 return -EIO;
731731 }
732732
733+ memset(&elreq, 0, sizeof(elreq));
734+
733735 elreq.req_sg_cnt = dma_map_sg(&ha->pdev->dev,
734736 bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt,
735737 DMA_TO_DEVICE);
@@ -795,10 +797,9 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) · 59 unmodified lines
795797
796798 if (atomic_read(&vha->loop_state) == LOOP_READY &&
797799 (ha->current_topology == ISP_CFG_F ||
798− ((IS_QLA81XX(ha) || IS_QLA8031(ha) || IS_QLA8044(ha)) &&
799− le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE
800− && req_data_len == MAX_ELS_FRAME_PAYLOAD)) &&
801− elreq.options == EXTERNAL_LOOPBACK) {
800+ (le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE &&
801+ req_data_len == MAX_ELS_FRAME_PAYLOAD)) &&
802+ elreq.options == EXTERNAL_LOOPBACK) {
802803 type = "FC_BSG_HST_VENDOR_ECHO_DIAG";
803804 ql_dbg(ql_dbg_user, vha, 0x701e,
804805 "BSG request type: %s.\n", type);
drivers/scsi/qla2xxx/qla_dbg.c+2−2
@@ -1131,7 +1131,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) · 1130 unmodified lines
11311131
11321132 /* Mailbox registers. */
11331133 mbx_reg = &reg->mailbox0;
1134− for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, dmp_reg++)
1134+ for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg++)
11351135 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg));
11361136
11371137 /* Transfer sequence registers. */
@@ -2090,7 +2090,7 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) · 952 unmodified lines
20902090
20912091 /* Mailbox registers. */
20922092 mbx_reg = &reg->mailbox0;
2093− for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, dmp_reg++)
2093+ for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg++)
20942094 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg));
20952095
20962096 /* Transfer sequence registers. */
drivers/scsi/qla2xxx/qla_def.h+1−0
@@ -3425,6 +3425,7 @@ struct qla_hw_data { · 3424 unmodified lines
34253425 uint8_t max_req_queues;
34263426 uint8_t max_rsp_queues;
34273427 uint8_t max_qpairs;
3428+ uint8_t num_qpairs;
34283429 struct qla_qpair *base_qpair;
34293430 struct qla_npiv_entry *npiv_info;
34303431 uint16_t nvram_npiv_size;
drivers/scsi/qla2xxx/qla_init.c+4−1
@@ -7543,12 +7543,13 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, int v · 7542 unmodified lines
75437543 /* Assign available que pair id */
75447544 mutex_lock(&ha->mq_lock);
75457545 qpair_id = find_first_zero_bit(ha->qpair_qid_map, ha->max_qpairs);
7546− if (qpair_id >= ha->max_qpairs) {
7546+ if (ha->num_qpairs >= ha->max_qpairs) {
75477547 mutex_unlock(&ha->mq_lock);
75487548 ql_log(ql_log_warn, vha, 0x0183,
75497549 "No resources to create additional q pair.\n");
75507550 goto fail_qid_map;
75517551 }
7552+ ha->num_qpairs++;
75527553 set_bit(qpair_id, ha->qpair_qid_map);
75537554 ha->queue_pair_map[qpair_id] = qpair;
75547555 qpair->id = qpair_id;
@@ -7635,6 +7636,7 @@ fail_rsp: · 80 unmodified lines
76357636 fail_msix:
76367637 ha->queue_pair_map[qpair_id] = NULL;
76377638 clear_bit(qpair_id, ha->qpair_qid_map);
7639+ ha->num_qpairs--;
76387640 mutex_unlock(&ha->mq_lock);
76397641 fail_qid_map:
76407642 kfree(qpair);
@@ -7660,6 +7662,7 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair) · 19 unmodified lines
76607662 mutex_lock(&ha->mq_lock);
76617663 ha->queue_pair_map[qpair->id] = NULL;
76627664 clear_bit(qpair->id, ha->qpair_qid_map);
7665+ ha->num_qpairs--;
76637666 list_del(&qpair->qp_list_elem);
76647667 if (list_empty(&vha->qp_list))
76657668 vha->flags.qpairs_available = 0;
drivers/scsi/qla2xxx/qla_inline.h+7−19
@@ -129,28 +129,16 @@ qla2x00_clear_loop_id(fc_port_t *fcport) { · 128 unmodified lines
129129 }
130130
131131 static inline void
132−qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp,
133− struct qla_tgt_cmd *tc)
132+qla2x00_clean_dsd_pool(struct qla_hw_data *ha, struct crc_context *ctx)
134133 {
135− struct dsd_dma *dsd_ptr, *tdsd_ptr;
136− struct crc_context *ctx;
137−
138− if (sp)
139− ctx = (struct crc_context *)GET_CMD_CTX_SP(sp);
140− else if (tc)
141− ctx = (struct crc_context *)tc->ctx;
142− else {
143− BUG();
144− return;
145− }
134+ struct dsd_dma *dsd, *tdsd;
146135
147136 /* clean up allocated prev pool */
148− list_for_each_entry_safe(dsd_ptr, tdsd_ptr,
149− &ctx->dsd_list, list) {
150− dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr,
151− dsd_ptr->dsd_list_dma);
152− list_del(&dsd_ptr->list);
153− kfree(dsd_ptr);
137+ list_for_each_entry_safe(dsd, tdsd, &ctx->dsd_list, list) {
138+ dma_pool_free(ha->dl_dma_pool, dsd->dsd_addr,
139+ dsd->dsd_list_dma);
140+ list_del(&dsd->list);
141+ kfree(dsd);
154142 }
155143 INIT_LIST_HEAD(&ctx->dsd_list);
156144 }
drivers/scsi/qla2xxx/qla_isr.c+1−1
@@ -3282,7 +3282,7 @@ msix_register_fail: · 3281 unmodified lines
32823282 }
32833283
32843284 /* Enable MSI-X vector for response queue update for queue 0 */
3285− if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
3285+ if (IS_QLA25XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
32863286 if (ha->msixbase && ha->mqiobase &&
32873287 (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 ||
32883288 ql2xmqsupport))
drivers/scsi/qla2xxx/qla_mbx.c+2−11
@@ -3676,15 +3676,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 3675 unmodified lines
36763676 qlt_update_host_map(vha, id);
36773677 }
36783678
3679− fc_host_port_name(vha->host) =
3680− wwn_to_u64(vha->port_name);
3681−
3682− if (qla_ini_mode_enabled(vha))
3683− ql_dbg(ql_dbg_mbx, vha, 0x1018,
3684− "FA-WWN portname %016llx (%x)\n",
3685− fc_host_port_name(vha->host),
3686− rptid_entry->vp_status);
3687−
36883679 set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags);
36893680 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
36903681 } else {
@@ -4821,9 +4812,9 @@ qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq, · 1130 unmodified lines
48214812
48224813 memset(mcp->mb, 0 , sizeof(mcp->mb));
48234814 mcp->mb[0] = MBC_DIAGNOSTIC_ECHO;
4824− mcp->mb[1] = mreq->options | BIT_6; /* BIT_6 specifies 64bit address */
4815+ /* BIT_6 specifies 64bit address */
4816+ mcp->mb[1] = mreq->options | BIT_15 | BIT_6;
48254817 if (IS_CNA_CAPABLE(ha)) {
4826− mcp->mb[1] |= BIT_15;
48274818 mcp->mb[2] = vha->fcoe_fcf_idx;
48284819 }
48294820 mcp->mb[16] = LSW(mreq->rcv_dma);
drivers/scsi/qla2xxx/qla_os.c+29−17
@@ -630,29 +630,34 @@ qla2x00_sp_free_dma(void *ptr) · 629 unmodified lines
630630 sp->flags &= ~SRB_CRC_PROT_DMA_VALID;
631631 }
632632
633+ if (!ctx)
634+ goto end;
635+
633636 if (sp->flags & SRB_CRC_CTX_DSD_VALID) {
634637 /* List assured to be having elements */
635− qla2x00_clean_dsd_pool(ha, sp, NULL);
638+ qla2x00_clean_dsd_pool(ha, ctx);
636639 sp->flags &= ~SRB_CRC_CTX_DSD_VALID;
637640 }
638641
639642 if (sp->flags & SRB_CRC_CTX_DMA_VALID) {
640− dma_pool_free(ha->dl_dma_pool, ctx,
641− ((struct crc_context *)ctx)->crc_ctx_dma);
643+ struct crc_context *ctx0 = ctx;
644+
645+ dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma);
642646 sp->flags &= ~SRB_CRC_CTX_DMA_VALID;
643647 }
644648
645649 if (sp->flags & SRB_FCP_CMND_DMA_VALID) {
646− struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx;
650+ struct ct6_dsd *ctx1 = ctx;
647651
648652 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd,
649− ctx1->fcp_cmnd_dma);
653+ ctx1->fcp_cmnd_dma);
650654 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list);
651655 ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt;
652656 ha->gbl_dsd_avail += ctx1->dsd_use_cnt;
653657 mempool_free(ctx1, ha->ctx_mempool);
654658 }
655659
660+end:
656661 CMD_SP(cmd) = NULL;
657662 qla2x00_rel_sp(sp);
658663 }
@@ -699,21 +704,24 @@ qla2xxx_qpair_sp_free_dma(void *ptr) · 40 unmodified lines
699704 sp->flags &= ~SRB_CRC_PROT_DMA_VALID;
700705 }
701706
707+ if (!ctx)
708+ goto end;
709+
702710 if (sp->flags & SRB_CRC_CTX_DSD_VALID) {
703711 /* List assured to be having elements */
704− qla2x00_clean_dsd_pool(ha, sp, NULL);
712+ qla2x00_clean_dsd_pool(ha, ctx);
705713 sp->flags &= ~SRB_CRC_CTX_DSD_VALID;
706714 }
707715
708716 if (sp->flags & SRB_CRC_CTX_DMA_VALID) {
709− dma_pool_free(ha->dl_dma_pool, ctx,
710− ((struct crc_context *)ctx)->crc_ctx_dma);
717+ struct crc_context *ctx0 = ctx;
718+
719+ dma_pool_free(ha->dl_dma_pool, ctx, ctx0->crc_ctx_dma);
711720 sp->flags &= ~SRB_CRC_CTX_DMA_VALID;
712721 }
713722
714723 if (sp->flags & SRB_FCP_CMND_DMA_VALID) {
715− struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx;
716−
724+ struct ct6_dsd *ctx1 = ctx;
717725 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd,
718726 ctx1->fcp_cmnd_dma);
719727 list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list);
@@ -721,7 +729,7 @@ qla2xxx_qpair_sp_free_dma(void *ptr) · 1 unmodified line
721729 ha->gbl_dsd_avail += ctx1->dsd_use_cnt;
722730 mempool_free(ctx1, ha->ctx_mempool);
723731 }
724−
732+end:
725733 CMD_SP(cmd) = NULL;
726734 qla2xxx_rel_qpair_sp(sp->qpair, sp);
727735 }
@@ -1632,7 +1640,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) · 904 unmodified lines
16321640 void
16331641 qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
16341642 {
1635− int que, cnt;
1643+ int que, cnt, status;
16361644 unsigned long flags;
16371645 srb_t *sp;
16381646 struct qla_hw_data *ha = vha->hw;
@@ -1662,8 +1670,12 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) · 23 unmodified lines
16621670 */
16631671 sp_get(sp);
16641672 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1665− qla2xxx_eh_abort(GET_CMD_SP(sp));
1673+ status = qla2xxx_eh_abort(GET_CMD_SP(sp));
16661674 spin_lock_irqsave(&ha->hardware_lock, flags);
1675+ /* Get rid of extra reference if immediate exit
1676+ * from ql2xxx_eh_abort */
1677+ if (status == FAILED && (qla2x00_isp_reg_stat(ha)))
1678+ atomic_dec(&sp->ref_count);
16671679 }
16681680 req->outstanding_cmds[cnt] = NULL;
16691681 sp->done(sp, res);
@@ -2623,10 +2635,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 953 unmodified lines
26232635
26242636 if (mem_only) {
26252637 if (pci_enable_device_mem(pdev))
2626− goto probe_out;
2638+ return ret;
26272639 } else {
26282640 if (pci_enable_device(pdev))
2629− goto probe_out;
2641+ return ret;
26302642 }
26312643
26322644 /* This may fail but that's ok */
@@ -2636,7 +2648,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 3 unmodified lines
26362648 if (!ha) {
26372649 ql_log_pci(ql_log_fatal, pdev, 0x0009,
26382650 "Unable to allocate memory for ha.\n");
2639− goto probe_out;
2651+ goto disable_device;
26402652 }
26412653 ql_dbg_pci(ql_dbg_init, pdev, 0x000a,
26422654 "Memory allocated for ha=%p.\n", ha);
@@ -3254,7 +3266,7 @@ iospace_config_failed: · 611 unmodified lines
32543266 pci_release_selected_regions(ha->pdev, ha->bars);
32553267 kfree(ha);
32563268
3257−probe_out:
3269+disable_device:
32583270 pci_disable_device(pdev);
32593271 return ret;
32603272 }
drivers/scsi/qla2xxx/qla_target.c+5−3
@@ -2245,11 +2245,13 @@ static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) · 2244 unmodified lines
22452245 pci_unmap_sg(ha->pdev, cmd->prot_sg, cmd->prot_sg_cnt,
22462246 cmd->dma_data_direction);
22472247
2248+ if (!cmd->ctx)
2249+ return;
2250+
22482251 if (cmd->ctx_dsd_alloced)
2249− qla2x00_clean_dsd_pool(ha, NULL, cmd);
2252+ qla2x00_clean_dsd_pool(ha, cmd->ctx);
22502253
2251− if (cmd->ctx)
2252− dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma);
2254+ dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma);
22532255 }
22542256
22552257 static int qlt_check_reserve_free_req(struct scsi_qla_host *vha,
drivers/scsi/qla2xxx/qla_tmpl.c+1−1
@@ -371,7 +371,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha, · 370 unmodified lines
371371 goto done;
372372 }
373373
374− if (end <= start || start == 0 || end == 0) {
374+ if (end < start || start == 0 || end == 0) {
375375 ql_dbg(ql_dbg_misc, vha, 0xd023,
376376 "%s: unusable range (start=%x end=%x)\n", __func__,
377377 ent->t262.end_addr, ent->t262.start_addr);
drivers/scsi/scsi_debug.c+1−1
@@ -1404,7 +1404,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) · 1403 unmodified lines
14041404 arr[4] = SDEBUG_LONG_INQ_SZ - 5;
14051405 arr[5] = (int)have_dif_prot; /* PROTECT bit */
14061406 if (sdebug_vpd_use_hostno == 0)
1407− arr[5] = 0x10; /* claim: implicit TGPS */
1407+ arr[5] |= 0x10; /* claim: implicit TPGS */
14081408 arr[6] = 0x10; /* claim: MultiP */
14091409 /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
14101410 arr[7] = 0xa; /* claim: LINKED + CMDQUE */
drivers/staging/ccree/Kconfig+1−1
@@ -1,6 +1,6 @@
11 config CRYPTO_DEV_CCREE
22 tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators"
3− depends on CRYPTO_HW && OF && HAS_DMA
3+ depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA
44 default n
55 select CRYPTO_HASH
66 select CRYPTO_BLKCIPHER
drivers/staging/ccree/ssi_buffer_mgr.c+2−1
@@ -216,7 +216,8 @@ void ssi_buffer_mgr_copy_scatterlist_portion( · 215 unmodified lines
216216 uint32_t nents, lbytes;
217217
218218 nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL);
219− sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip), 0, (direct == SSI_SG_TO_BUF));
219+ sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip + 1), to_skip,
220+ (direct == SSI_SG_TO_BUF));
220221 }
221222
222223 static inline int ssi_buffer_mgr_render_buff_to_mlli(
drivers/staging/lustre/lustre/lov/lov_pack.c+0−9
@@ -293,18 +293,10 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, · 292 unmodified lines
293293 size_t lmmk_size;
294294 size_t lum_size;
295295 int rc;
296− mm_segment_t seg;
297296
298297 if (!lsm)
299298 return -ENODATA;
300299
301− /*
302− * "Switch to kernel segment" to allow copying from kernel space by
303− * copy_{to,from}_user().
304− */
305− seg = get_fs();
306− set_fs(KERNEL_DS);
307−
308300 if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) {
309301 CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n",
310302 lsm->lsm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3);
@@ -406,6 +398,5 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, · 95 unmodified lines
406398 out_free:
407399 kvfree(lmmk);
408400 out:
409− set_fs(seg);
410401 return rc;
411402 }
drivers/staging/rtl8188eu/os_dep/mon.c+1−1
@@ -152,7 +152,7 @@ static const struct net_device_ops mon_netdev_ops = { · 151 unmodified lines
152152 static void mon_setup(struct net_device *dev)
153153 {
154154 dev->netdev_ops = &mon_netdev_ops;
155− dev->destructor = free_netdev;
155+ dev->needs_free_netdev = true;
156156 ether_setup(dev);
157157 dev->priv_flags |= IFF_NO_QUEUE;
158158 dev->type = ARPHRD_IEEE80211;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+2−1
@@ -2667,7 +2667,8 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st · 2666 unmodified lines
26672667 mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
26682668 strncpy(mon_ndev->name, name, IFNAMSIZ);
26692669 mon_ndev->name[IFNAMSIZ - 1] = 0;
2670− mon_ndev->destructor = rtw_ndev_destructor;
2670+ mon_ndev->needs_free_netdev = true;
2671+ mon_ndev->priv_destructor = rtw_ndev_destructor;
26712672
26722673 mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
26732674
drivers/staging/rtl8723bs/os_dep/os_intfs.c+0−2
@@ -1207,8 +1207,6 @@ void rtw_ndev_destructor(struct net_device *ndev) · 1206 unmodified lines
12071207
12081208 if (ndev->ieee80211_ptr)
12091209 kfree((u8 *)ndev->ieee80211_ptr);
1210−
1211− free_netdev(ndev);
12121210 }
12131211
12141212 void rtw_dev_unload(struct adapter *padapter)
drivers/usb/chipidea/core.c+4−1
@@ -843,7 +843,10 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr, · 842 unmodified lines
843843 {
844844 struct ci_hdrc *ci = dev_get_drvdata(dev);
845845
846− return sprintf(buf, "%s\n", ci_role(ci)->name);
846+ if (ci->role != CI_ROLE_END)
847+ return sprintf(buf, "%s\n", ci_role(ci)->name);
848+
849+ return 0;
847850 }
848851
849852 static ssize_t ci_role_store(struct device *dev,
drivers/usb/chipidea/debug.c+2−1
@@ -294,7 +294,8 @@ static int ci_role_show(struct seq_file *s, void *data) · 293 unmodified lines
294294 {
295295 struct ci_hdrc *ci = s->private;
296296
297− seq_printf(s, "%s\n", ci_role(ci)->name);
297+ if (ci->role != CI_ROLE_END)
298+ seq_printf(s, "%s\n", ci_role(ci)->name);
298299
299300 return 0;
300301 }
drivers/usb/chipidea/udc.c+6−2
@@ -1993,6 +1993,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci) · 1992 unmodified lines
19931993 int ci_hdrc_gadget_init(struct ci_hdrc *ci)
19941994 {
19951995 struct ci_role_driver *rdrv;
1996+ int ret;
19961997
19971998 if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
19981999 return -ENXIO;
@@ -2005,7 +2006,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci) · 6 unmodified lines
20052006 rdrv->stop = udc_id_switch_for_host;
20062007 rdrv->irq = udc_irq;
20072008 rdrv->name = "gadget";
2008− ci->roles[CI_ROLE_GADGET] = rdrv;
20092009
2010− return udc_start(ci);
2010+ ret = udc_start(ci);
2011+ if (!ret)
2012+ ci->roles[CI_ROLE_GADGET] = rdrv;
2013+
2014+ return ret;
20112015 }
drivers/usb/chipidea/usbmisc_imx.c+32−9
@@ -108,6 +108,8 @@ struct imx_usbmisc { · 107 unmodified lines
108108 const struct usbmisc_ops *ops;
109109 };
110110
111+static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data);
112+
111113 static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
112114 {
113115 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
@@ -242,10 +244,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) · 128 unmodified lines
242244 val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
243245 | MX53_USB_UHx_CTRL_ULPI_INT_EN;
244246 writel(val, reg);
245− /* Disable internal 60Mhz clock */
246− reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
247− val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
248− writel(val, reg);
247+ if (is_imx53_usbmisc(data)) {
248+ /* Disable internal 60Mhz clock */
249+ reg = usbmisc->base +
250+ MX53_USB_CLKONOFF_CTRL_OFFSET;
251+ val = readl(reg) |
252+ MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
253+ writel(val, reg);
254+ }
255+
249256 }
250257 if (data->disable_oc) {
251258 reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
@@ -267,10 +274,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) · 15 unmodified lines
267274 val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
268275 | MX53_USB_UHx_CTRL_ULPI_INT_EN;
269276 writel(val, reg);
270− /* Disable internal 60Mhz clock */
271− reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
272− val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
273− writel(val, reg);
277+
278+ if (is_imx53_usbmisc(data)) {
279+ /* Disable internal 60Mhz clock */
280+ reg = usbmisc->base +
281+ MX53_USB_CLKONOFF_CTRL_OFFSET;
282+ val = readl(reg) |
283+ MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
284+ writel(val, reg);
285+ }
274286 }
275287 if (data->disable_oc) {
276288 reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
@@ -456,6 +468,10 @@ static const struct usbmisc_ops imx27_usbmisc_ops = { · 179 unmodified lines
456468 .init = usbmisc_imx27_init,
457469 };
458470
471+static const struct usbmisc_ops imx51_usbmisc_ops = {
472+ .init = usbmisc_imx53_init,
473+};
474+
459475 static const struct usbmisc_ops imx53_usbmisc_ops = {
460476 .init = usbmisc_imx53_init,
461477 };
@@ -479,6 +495,13 @@ static const struct usbmisc_ops imx7d_usbmisc_ops = { · 17 unmodified lines
479495 .set_wakeup = usbmisc_imx7d_set_wakeup,
480496 };
481497
498+static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data)
499+{
500+ struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
501+
502+ return usbmisc->ops == &imx53_usbmisc_ops;
503+}
504+
482505 int imx_usbmisc_init(struct imx_usbmisc_data *data)
483506 {
484507 struct imx_usbmisc *usbmisc;
@@ -536,7 +559,7 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { · 51 unmodified lines
536559 },
537560 {
538561 .compatible = "fsl,imx51-usbmisc",
539− .data = &imx53_usbmisc_ops,
562+ .data = &imx51_usbmisc_ops,
540563 },
541564 {
542565 .compatible = "fsl,imx53-usbmisc",
drivers/usb/dwc2/params.c+2−0
@@ -144,6 +144,8 @@ const struct of_device_id dwc2_of_match_table[] = { · 143 unmodified lines
144144 { .compatible = "lantiq,xrx200-usb", .data = dwc2_set_ltq_params },
145145 { .compatible = "snps,dwc2" },
146146 { .compatible = "samsung,s3c6400-hsotg" },
147+ { .compatible = "amlogic,meson8-usb",
148+ .data = dwc2_set_amlogic_params },
147149 { .compatible = "amlogic,meson8b-usb",
148150 .data = dwc2_set_amlogic_params },
149151 { .compatible = "amlogic,meson-gxbb-usb",
drivers/usb/gadget/function/f_mass_storage.c+11−2
@@ -396,7 +396,11 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) · 395 unmodified lines
396396 /* Caller must hold fsg->lock */
397397 static void wakeup_thread(struct fsg_common *common)
398398 {
399− smp_wmb(); /* ensure the write of bh->state is complete */
399+ /*
400+ * Ensure the reading of thread_wakeup_needed
401+ * and the writing of bh->state are completed
402+ */
403+ smp_mb();
400404 /* Tell the main thread that something has happened */
401405 common->thread_wakeup_needed = 1;
402406 if (common->thread_task)
@@ -627,7 +631,12 @@ static int sleep_thread(struct fsg_common *common, bool can_freeze) · 224 unmodified lines
627631 }
628632 __set_current_state(TASK_RUNNING);
629633 common->thread_wakeup_needed = 0;
630− smp_rmb(); /* ensure the latest bh->state is visible */
634+
635+ /*
636+ * Ensure the writing of thread_wakeup_needed
637+ * and the reading of bh->state are completed
638+ */
639+ smp_mb();
631640 return rc;
632641 }
633642
drivers/usb/gadget/function/f_phonet.c+1−1
@@ -281,7 +281,7 @@ static void pn_net_setup(struct net_device *dev) · 280 unmodified lines
281281 dev->tx_queue_len = 1;
282282
283283 dev->netdev_ops = &pn_netdev_ops;
284− dev->destructor = free_netdev;
284+ dev->needs_free_netdev = true;
285285 dev->header_ops = &phonet_header_ops;
286286 }
287287
drivers/usb/gadget/udc/renesas_usb3.c+32−13
@@ -623,7 +623,6 @@ static void renesas_usb3_stop_controller(struct renesas_usb3 *usb3) · 622 unmodified lines
623623 {
624624 usb3_disconnect(usb3);
625625 usb3_write(usb3, 0, USB3_P0_INT_ENA);
626− usb3_write(usb3, 0, USB3_PN_INT_ENA);
627626 usb3_write(usb3, 0, USB3_USB_OTG_INT_ENA);
628627 usb3_write(usb3, 0, USB3_USB_INT_ENA_1);
629628 usb3_write(usb3, 0, USB3_USB_INT_ENA_2);
@@ -1475,7 +1474,13 @@ static void usb3_request_done_pipen(struct renesas_usb3 *usb3, · 845 unmodified lines
14751474 struct renesas_usb3_request *usb3_req,
14761475 int status)
14771476 {
1478− usb3_pn_stop(usb3);
1477+ unsigned long flags;
1478+
1479+ spin_lock_irqsave(&usb3->lock, flags);
1480+ if (usb3_pn_change(usb3, usb3_ep->num))
1481+ usb3_pn_stop(usb3);
1482+ spin_unlock_irqrestore(&usb3->lock, flags);
1483+
14791484 usb3_disable_pipe_irq(usb3, usb3_ep->num);
14801485 usb3_request_done(usb3_ep, usb3_req, status);
14811486
@@ -1504,30 +1509,46 @@ static void usb3_irq_epc_pipen_bfrdy(struct renesas_usb3 *usb3, int num) · 22 unmodified lines
15041509 {
15051510 struct renesas_usb3_ep *usb3_ep = usb3_get_ep(usb3, num);
15061511 struct renesas_usb3_request *usb3_req = usb3_get_request(usb3_ep);
1512+ bool done = false;
15071513
15081514 if (!usb3_req)
15091515 return;
15101516
1517+ spin_lock(&usb3->lock);
1518+ if (usb3_pn_change(usb3, num))
1519+ goto out;
1520+
15111521 if (usb3_ep->dir_in) {
15121522 /* Do not stop the IN pipe here to detect LSTTR interrupt */
15131523 if (!usb3_write_pipe(usb3_ep, usb3_req, USB3_PN_WRITE))
15141524 usb3_clear_bit(usb3, PN_INT_BFRDY, USB3_PN_INT_ENA);
15151525 } else {
15161526 if (!usb3_read_pipe(usb3_ep, usb3_req, USB3_PN_READ))
1517− usb3_request_done_pipen(usb3, usb3_ep, usb3_req, 0);
1527+ done = true;
15181528 }
1529+
1530+out:
1531+ /* need to unlock because usb3_request_done_pipen() locks it */
1532+ spin_unlock(&usb3->lock);
1533+
1534+ if (done)
1535+ usb3_request_done_pipen(usb3, usb3_ep, usb3_req, 0);
15191536 }
15201537
15211538 static void usb3_irq_epc_pipen(struct renesas_usb3 *usb3, int num)
15221539 {
15231540 u32 pn_int_sta;
15241541
1525− if (usb3_pn_change(usb3, num) < 0)
1542+ spin_lock(&usb3->lock);
1543+ if (usb3_pn_change(usb3, num) < 0) {
1544+ spin_unlock(&usb3->lock);
15261545 return;
1546+ }
15271547
15281548 pn_int_sta = usb3_read(usb3, USB3_PN_INT_STA);
15291549 pn_int_sta &= usb3_read(usb3, USB3_PN_INT_ENA);
15301550 usb3_write(usb3, pn_int_sta, USB3_PN_INT_STA);
1551+ spin_unlock(&usb3->lock);
15311552 if (pn_int_sta & PN_INT_LSTTR)
15321553 usb3_irq_epc_pipen_lsttr(usb3, num);
15331554 if (pn_int_sta & PN_INT_BFRDY)
@@ -1660,6 +1681,7 @@ static int usb3_disable_pipe_n(struct renesas_usb3_ep *usb3_ep) · 126 unmodified lines
16601681
16611682 spin_lock_irqsave(&usb3->lock, flags);
16621683 if (!usb3_pn_change(usb3, usb3_ep->num)) {
1684+ usb3_write(usb3, 0, USB3_PN_INT_ENA);
16631685 usb3_write(usb3, 0, USB3_PN_RAMMAP);
16641686 usb3_clear_bit(usb3, PN_CON_EN, USB3_PN_CON);
16651687 }
@@ -1799,6 +1821,9 @@ static int renesas_usb3_start(struct usb_gadget *gadget, · 133 unmodified lines
17991821 /* hook up the driver */
18001822 usb3->driver = driver;
18011823
1824+ pm_runtime_enable(usb3_to_dev(usb3));
1825+ pm_runtime_get_sync(usb3_to_dev(usb3));
1826+
18021827 renesas_usb3_init_controller(usb3);
18031828
18041829 return 0;
@@ -1807,14 +1832,14 @@ static int renesas_usb3_start(struct usb_gadget *gadget, · 2 unmodified lines
18071832 static int renesas_usb3_stop(struct usb_gadget *gadget)
18081833 {
18091834 struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget);
1810− unsigned long flags;
18111835
1812− spin_lock_irqsave(&usb3->lock, flags);
18131836 usb3->softconnect = false;
18141837 usb3->gadget.speed = USB_SPEED_UNKNOWN;
18151838 usb3->driver = NULL;
18161839 renesas_usb3_stop_controller(usb3);
1817− spin_unlock_irqrestore(&usb3->lock, flags);
1840+
1841+ pm_runtime_put(usb3_to_dev(usb3));
1842+ pm_runtime_disable(usb3_to_dev(usb3));
18181843
18191844 return 0;
18201845 }
@@ -1891,9 +1916,6 @@ static int renesas_usb3_remove(struct platform_device *pdev) · 70 unmodified lines
18911916
18921917 device_remove_file(&pdev->dev, &dev_attr_role);
18931918
1894− pm_runtime_put(&pdev->dev);
1895− pm_runtime_disable(&pdev->dev);
1896−
18971919 usb_del_gadget_udc(&usb3->gadget);
18981920
18991921 __renesas_usb3_ep_free_request(usb3->ep0_req);
@@ -2099,9 +2121,6 @@ static int renesas_usb3_probe(struct platform_device *pdev) · 199 unmodified lines
20992121
21002122 usb3->workaround_for_vbus = priv->workaround_for_vbus;
21012123
2102− pm_runtime_enable(&pdev->dev);
2103− pm_runtime_get_sync(&pdev->dev);
2104−
21052124 dev_info(&pdev->dev, "probed\n");
21062125
21072126 return 0;
drivers/usb/musb/musb_dsps.c+5−0
@@ -245,6 +245,11 @@ static int dsps_check_status(struct musb *musb, void *unused) · 244 unmodified lines
245245 dsps_mod_timer_optional(glue);
246246 break;
247247 case OTG_STATE_A_WAIT_BCON:
248+ /* keep VBUS on for host-only mode */
249+ if (musb->port_mode == MUSB_PORT_MODE_HOST) {
250+ dsps_mod_timer_optional(glue);
251+ break;
252+ }
248253 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
249254 skip_session = 1;
250255 /* fall */
drivers/xen/privcmd.c+2−2
@@ -362,8 +362,8 @@ static int mmap_batch_fn(void *data, int nr, void *state) · 361 unmodified lines
362362 st->global_error = 1;
363363 }
364364 }
365− st->va += PAGE_SIZE * nr;
366− st->index += nr;
365+ st->va += XEN_PAGE_SIZE * nr;
366+ st->index += nr / XEN_PFN_PER_PAGE;
367367
368368 return 0;
369369 }
fs/btrfs/ctree.h+2−2
@@ -2563,7 +2563,7 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes); · 2562 unmodified lines
25632563 static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_fs_info *fs_info,
25642564 unsigned num_items)
25652565 {
2566− return fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items;
2566+ return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items;
25672567 }
25682568
25692569 /*
@@ -2573,7 +2573,7 @@ static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_fs_info *fs_info, · 3 unmodified lines
25732573 static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info,
25742574 unsigned num_items)
25752575 {
2576− return fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
2576+ return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
25772577 }
25782578
25792579 int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
fs/btrfs/dir-item.c+1−1
@@ -468,7 +468,7 @@ int verify_dir_item(struct btrfs_fs_info *fs_info, · 467 unmodified lines
468468
469469 if (btrfs_dir_name_len(leaf, dir_item) > namelen) {
470470 btrfs_crit(fs_info, "invalid dir item name len: %u",
471− (unsigned)btrfs_dir_data_len(leaf, dir_item));
471+ (unsigned)btrfs_dir_name_len(leaf, dir_item));
472472 return 1;
473473 }
474474
fs/btrfs/disk-io.c+6−4
@@ -3467,10 +3467,12 @@ static int write_dev_supers(struct btrfs_device *device, · 3466 unmodified lines
34673467 * we fua the first super. The others we allow
34683468 * to go down lazy.
34693469 */
3470− if (i == 0)
3471− ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh);
3472− else
3470+ if (i == 0) {
3471+ ret = btrfsic_submit_bh(REQ_OP_WRITE,
3472+ REQ_SYNC | REQ_FUA, bh);
3473+ } else {
34733474 ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
3475+ }
34743476 if (ret)
34753477 errors++;
34763478 }
@@ -3535,7 +3537,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait) · 58 unmodified lines
35353537
35363538 bio->bi_end_io = btrfs_end_empty_barrier;
35373539 bio->bi_bdev = device->bdev;
3538− bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
3540+ bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
35393541 init_completion(&device->flush_wait);
35403542 bio->bi_private = &device->flush_wait;
35413543 device->flush_bio = bio;
fs/btrfs/extent-tree.c+4−3
@@ -3993,6 +3993,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, · 3992 unmodified lines
39933993 info->space_info_kobj, "%s",
39943994 alloc_name(found->flags));
39953995 if (ret) {
3996+ percpu_counter_destroy(&found->total_bytes_pinned);
39963997 kfree(found);
39973998 return ret;
39983999 }
@@ -4844,7 +4845,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info, · 845 unmodified lines
48444845 spin_unlock(&delayed_rsv->lock);
48454846
48464847 commit:
4847− trans = btrfs_join_transaction(fs_info->fs_root);
4848+ trans = btrfs_join_transaction(fs_info->extent_root);
48484849 if (IS_ERR(trans))
48494850 return -ENOSPC;
48504851
@@ -4862,7 +4863,7 @@ static int flush_space(struct btrfs_fs_info *fs_info, · 11 unmodified lines
48624863 struct btrfs_space_info *space_info, u64 num_bytes,
48634864 u64 orig_bytes, int state)
48644865 {
4865− struct btrfs_root *root = fs_info->fs_root;
4866+ struct btrfs_root *root = fs_info->extent_root;
48664867 struct btrfs_trans_handle *trans;
48674868 int nr;
48684869 int ret = 0;
@@ -5062,7 +5063,7 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info, · 193 unmodified lines
50625063 int flush_state = FLUSH_DELAYED_ITEMS_NR;
50635064
50645065 spin_lock(&space_info->lock);
5065− to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->fs_root,
5066+ to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->extent_root,
50665067 space_info);
50675068 if (!to_reclaim) {
50685069 spin_unlock(&space_info->lock);
fs/btrfs/extent_io.c+123−3
@@ -2458,7 +2458,7 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end) · 2457 unmodified lines
24582458 if (!uptodate) {
24592459 ClearPageUptodate(page);
24602460 SetPageError(page);
2461− ret = ret < 0 ? ret : -EIO;
2461+ ret = err < 0 ? err : -EIO;
24622462 mapping_set_error(page->mapping, ret);
24632463 }
24642464 }
@@ -4377,6 +4377,123 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode, · 1912 unmodified lines
43774377 return NULL;
43784378 }
43794379
4380+/*
4381+ * To cache previous fiemap extent
4382+ *
4383+ * Will be used for merging fiemap extent
4384+ */
4385+struct fiemap_cache {
4386+ u64 offset;
4387+ u64 phys;
4388+ u64 len;
4389+ u32 flags;
4390+ bool cached;
4391+};
4392+
4393+/*
4394+ * Helper to submit fiemap extent.
4395+ *
4396+ * Will try to merge current fiemap extent specified by @offset, @phys,
4397+ * @len and @flags with cached one.
4398+ * And only when we fails to merge, cached one will be submitted as
4399+ * fiemap extent.
4400+ *
4401+ * Return value is the same as fiemap_fill_next_extent().
4402+ */
4403+static int emit_fiemap_extent(struct fiemap_extent_info *fieinfo,
4404+ struct fiemap_cache *cache,
4405+ u64 offset, u64 phys, u64 len, u32 flags)
4406+{
4407+ int ret = 0;
4408+
4409+ if (!cache->cached)
4410+ goto assign;
4411+
4412+ /*
4413+ * Sanity check, extent_fiemap() should have ensured that new
4414+ * fiemap extent won't overlap with cahced one.
4415+ * Not recoverable.
4416+ *
4417+ * NOTE: Physical address can overlap, due to compression
4418+ */
4419+ if (cache->offset + cache->len > offset) {
4420+ WARN_ON(1);
4421+ return -EINVAL;
4422+ }
4423+
4424+ /*
4425+ * Only merges fiemap extents if
4426+ * 1) Their logical addresses are continuous
4427+ *
4428+ * 2) Their physical addresses are continuous
4429+ * So truly compressed (physical size smaller than logical size)
4430+ * extents won't get merged with each other
4431+ *
4432+ * 3) Share same flags except FIEMAP_EXTENT_LAST
4433+ * So regular extent won't get merged with prealloc extent
4434+ */
4435+ if (cache->offset + cache->len == offset &&
4436+ cache->phys + cache->len == phys &&
4437+ (cache->flags & ~FIEMAP_EXTENT_LAST) ==
4438+ (flags & ~FIEMAP_EXTENT_LAST)) {
4439+ cache->len += len;
4440+ cache->flags |= flags;
4441+ goto try_submit_last;
4442+ }
4443+
4444+ /* Not mergeable, need to submit cached one */
4445+ ret = fiemap_fill_next_extent(fieinfo, cache->offset, cache->phys,
4446+ cache->len, cache->flags);
4447+ cache->cached = false;
4448+ if (ret)
4449+ return ret;
4450+assign:
4451+ cache->cached = true;
4452+ cache->offset = offset;
4453+ cache->phys = phys;
4454+ cache->len = len;
4455+ cache->flags = flags;
4456+try_submit_last:
4457+ if (cache->flags & FIEMAP_EXTENT_LAST) {
4458+ ret = fiemap_fill_next_extent(fieinfo, cache->offset,
4459+ cache->phys, cache->len, cache->flags);
4460+ cache->cached = false;
4461+ }
4462+ return ret;
4463+}
4464+
4465+/*
4466+ * Sanity check for fiemap cache
4467+ *
4468+ * All fiemap cache should be submitted by emit_fiemap_extent()
4469+ * Iteration should be terminated either by last fiemap extent or
4470+ * fieinfo->fi_extents_max.
4471+ * So no cached fiemap should exist.
4472+ */
4473+static int check_fiemap_cache(struct btrfs_fs_info *fs_info,
4474+ struct fiemap_extent_info *fieinfo,
4475+ struct fiemap_cache *cache)
4476+{
4477+ int ret;
4478+
4479+ if (!cache->cached)
4480+ return 0;
4481+
4482+ /* Small and recoverbale problem, only to info developer */
4483+#ifdef CONFIG_BTRFS_DEBUG
4484+ WARN_ON(1);
4485+#endif
4486+ btrfs_warn(fs_info,
4487+ "unhandled fiemap cache detected: offset=%llu phys=%llu len=%llu flags=0x%x",
4488+ cache->offset, cache->phys, cache->len, cache->flags);
4489+ ret = fiemap_fill_next_extent(fieinfo, cache->offset, cache->phys,
4490+ cache->len, cache->flags);
4491+ cache->cached = false;
4492+ if (ret > 0)
4493+ ret = 0;
4494+ return ret;
4495+}
4496+
43804497 int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
43814498 __u64 start, __u64 len, get_extent_t *get_extent)
43824499 {
@@ -4394,6 +4511,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 11 unmodified lines
43944511 struct extent_state *cached_state = NULL;
43954512 struct btrfs_path *path;
43964513 struct btrfs_root *root = BTRFS_I(inode)->root;
4514+ struct fiemap_cache cache = { 0 };
43974515 int end = 0;
43984516 u64 em_start = 0;
43994517 u64 em_len = 0;
@@ -4573,8 +4691,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 173 unmodified lines
45734691 flags |= FIEMAP_EXTENT_LAST;
45744692 end = 1;
45754693 }
4576− ret = fiemap_fill_next_extent(fieinfo, em_start, disko,
4577− em_len, flags);
4694+ ret = emit_fiemap_extent(fieinfo, &cache, em_start, disko,
4695+ em_len, flags);
45784696 if (ret) {
45794697 if (ret == 1)
45804698 ret = 0;
@@ -4582,6 +4700,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 1 unmodified line
45824700 }
45834701 }
45844702 out_free:
4703+ if (!ret)
4704+ ret = check_fiemap_cache(root->fs_info, fieinfo, &cache);
45854705 free_extent_map(em);
45864706 out:
45874707 btrfs_free_path(path);
fs/btrfs/hash.c+4−1
@@ -38,6 +38,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 37 unmodified lines
3838 {
3939 SHASH_DESC_ON_STACK(shash, tfm);
4040 u32 *ctx = (u32 *)shash_desc_ctx(shash);
41+ u32 retval;
4142 int err;
4243
4344 shash->tfm = tfm;
@@ -47,5 +48,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines
4748 err = crypto_shash_update(shash, address, length);
4849 BUG_ON(err);
4950
50− return *ctx;
51+ retval = *ctx;
52+ barrier_data(ctx);
53+ return retval;
5154 }
fs/btrfs/inode.c+3−3
@@ -2952,7 +2952,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) · 2951 unmodified lines
29522952
29532953 ret = test_range_bit(io_tree, ordered_extent->file_offset,
29542954 ordered_extent->file_offset + ordered_extent->len - 1,
2955− EXTENT_DEFRAG, 1, cached_state);
2955+ EXTENT_DEFRAG, 0, cached_state);
29562956 if (ret) {
29572957 u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item);
29582958 if (0 && last_snapshot >= BTRFS_I(inode)->generation)
@@ -7483,8 +7483,8 @@ bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end) · 4524 unmodified lines
74837483 int found = false;
74847484 void **pagep = NULL;
74857485 struct page *page = NULL;
7486− int start_idx;
7487− int end_idx;
7486+ unsigned long start_idx;
7487+ unsigned long end_idx;
74887488
74897489 start_idx = start >> PAGE_SHIFT;
74907490
fs/ext4/acl.c+4−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
55 */
66
7+#include <linux/quotaops.h>
78 #include "ext4_jbd2.h"
89 #include "ext4.h"
910 #include "xattr.h"
@@ -232,6 +233,9 @@ ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type) · 222 unmodified lines
232233 handle_t *handle;
233234 int error, retries = 0;
234235
236+ error = dquot_initialize(inode);
237+ if (error)
238+ return error;
235239 retry:
236240 handle = ext4_journal_start(inode, EXT4_HT_XATTR,
237241 ext4_jbd2_credits_xattr(inode));
fs/ext4/ext4.h+0−2
@@ -2523,7 +2523,6 @@ extern int ext4_search_dir(struct buffer_head *bh, · 2522 unmodified lines
25232523 int buf_size,
25242524 struct inode *dir,
25252525 struct ext4_filename *fname,
2526− const struct qstr *d_name,
25272526 unsigned int offset,
25282527 struct ext4_dir_entry_2 **res_dir);
25292528 extern int ext4_generic_delete_entry(handle_t *handle,
@@ -3007,7 +3006,6 @@ extern int htree_inlinedir_to_tree(struct file *dir_file, · 477 unmodified lines
30073006 int *has_inline_data);
30083007 extern struct buffer_head *ext4_find_inline_entry(struct inode *dir,
30093008 struct ext4_filename *fname,
3010− const struct qstr *d_name,
30113009 struct ext4_dir_entry_2 **res_dir,
30123010 int *has_inline_data);
30133011 extern int ext4_delete_inline_entry(handle_t *handle,
fs/ext4/extents.c+42−43
@@ -3413,13 +3413,13 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 3412 unmodified lines
34133413 struct ext4_sb_info *sbi;
34143414 struct ext4_extent_header *eh;
34153415 struct ext4_map_blocks split_map;
3416− struct ext4_extent zero_ex;
3416+ struct ext4_extent zero_ex1, zero_ex2;
34173417 struct ext4_extent *ex, *abut_ex;
34183418 ext4_lblk_t ee_block, eof_block;
34193419 unsigned int ee_len, depth, map_len = map->m_len;
34203420 int allocated = 0, max_zeroout = 0;
34213421 int err = 0;
3422− int split_flag = 0;
3422+ int split_flag = EXT4_EXT_DATA_VALID2;
34233423
34243424 ext_debug("ext4_ext_convert_to_initialized: inode %lu, logical"
34253425 "block %llu, max_blocks %u\n", inode->i_ino,
@@ -3436,7 +3436,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 10 unmodified lines
34363436 ex = path[depth].p_ext;
34373437 ee_block = le32_to_cpu(ex->ee_block);
34383438 ee_len = ext4_ext_get_actual_len(ex);
3439− zero_ex.ee_len = 0;
3439+ zero_ex1.ee_len = 0;
3440+ zero_ex2.ee_len = 0;
34403441
34413442 trace_ext4_ext_convert_to_initialized_enter(inode, map, ex);
34423443
@@ -3576,62 +3577,52 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 133 unmodified lines
35763577 if (ext4_encrypted_inode(inode))
35773578 max_zeroout = 0;
35783579
3579− /* If extent is less than s_max_zeroout_kb, zeroout directly */
3580− if (max_zeroout && (ee_len <= max_zeroout)) {
3581− err = ext4_ext_zeroout(inode, ex);
3582− if (err)
3583− goto out;
3584− zero_ex.ee_block = ex->ee_block;
3585− zero_ex.ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex));
3586− ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex));
3587−
3588− err = ext4_ext_get_access(handle, inode, path + depth);
3589− if (err)
3590− goto out;
3591− ext4_ext_mark_initialized(ex);
3592− ext4_ext_try_to_merge(handle, inode, path, ex);
3593− err = ext4_ext_dirty(handle, inode, path + path->p_depth);
3594− goto out;
3595− }
3596−
35973580 /*
3598− * four cases:
3581+ * five cases:
35993582 * 1. split the extent into three extents.
3600− * 2. split the extent into two extents, zeroout the first half.
3601− * 3. split the extent into two extents, zeroout the second half.
3583+ * 2. split the extent into two extents, zeroout the head of the first
3584+ * extent.
3585+ * 3. split the extent into two extents, zeroout the tail of the second
3586+ * extent.
36023587 * 4. split the extent into two extents with out zeroout.
3588+ * 5. no splitting needed, just possibly zeroout the head and / or the
3589+ * tail of the extent.
36033590 */
36043591 split_map.m_lblk = map->m_lblk;
36053592 split_map.m_len = map->m_len;
36063593
3607− if (max_zeroout && (allocated > map->m_len)) {
3594+ if (max_zeroout && (allocated > split_map.m_len)) {
36083595 if (allocated <= max_zeroout) {
3609− /* case 3 */
3610− zero_ex.ee_block =
3611− cpu_to_le32(map->m_lblk);
3612− zero_ex.ee_len = cpu_to_le16(allocated);
3613− ext4_ext_store_pblock(&zero_ex,
3614− ext4_ext_pblock(ex) + map->m_lblk - ee_block);
3615− err = ext4_ext_zeroout(inode, &zero_ex);
3596+ /* case 3 or 5 */
3597+ zero_ex1.ee_block =
3598+ cpu_to_le32(split_map.m_lblk +
3599+ split_map.m_len);
3600+ zero_ex1.ee_len =
3601+ cpu_to_le16(allocated - split_map.m_len);
3602+ ext4_ext_store_pblock(&zero_ex1,
3603+ ext4_ext_pblock(ex) + split_map.m_lblk +
3604+ split_map.m_len - ee_block);
3605+ err = ext4_ext_zeroout(inode, &zero_ex1);
36163606 if (err)
36173607 goto out;
3618− split_map.m_lblk = map->m_lblk;
36193608 split_map.m_len = allocated;
3620− } else if (map->m_lblk - ee_block + map->m_len < max_zeroout) {
3621− /* case 2 */
3622− if (map->m_lblk != ee_block) {
3623− zero_ex.ee_block = ex->ee_block;
3624− zero_ex.ee_len = cpu_to_le16(map->m_lblk -
3609+ }
3610+ if (split_map.m_lblk - ee_block + split_map.m_len <
3611+ max_zeroout) {
3612+ /* case 2 or 5 */
3613+ if (split_map.m_lblk != ee_block) {
3614+ zero_ex2.ee_block = ex->ee_block;
3615+ zero_ex2.ee_len = cpu_to_le16(split_map.m_lblk -
36253616 ee_block);
3626− ext4_ext_store_pblock(&zero_ex,
3617+ ext4_ext_store_pblock(&zero_ex2,
36273618 ext4_ext_pblock(ex));
3628− err = ext4_ext_zeroout(inode, &zero_ex);
3619+ err = ext4_ext_zeroout(inode, &zero_ex2);
36293620 if (err)
36303621 goto out;
36313622 }
36323623
3624+ split_map.m_len += split_map.m_lblk - ee_block;
36333625 split_map.m_lblk = ee_block;
3634− split_map.m_len = map->m_lblk - ee_block + map->m_len;
36353626 allocated = map->m_len;
36363627 }
36373628 }
@@ -3642,8 +3633,11 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 4 unmodified lines
36423633 err = 0;
36433634 out:
36443635 /* If we have gotten a failure, don't zero out status tree */
3645− if (!err)
3646− err = ext4_zeroout_es(inode, &zero_ex);
3636+ if (!err) {
3637+ err = ext4_zeroout_es(inode, &zero_ex1);
3638+ if (!err)
3639+ err = ext4_zeroout_es(inode, &zero_ex2);
3640+ }
36473641 return err ? err : allocated;
36483642 }
36493643
@@ -4883,6 +4877,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 1233 unmodified lines
48834877
48844878 /* Zero out partial block at the edges of the range */
48854879 ret = ext4_zero_partial_blocks(handle, inode, offset, len);
4880+ if (ret >= 0)
4881+ ext4_update_inode_fsync_trans(handle, inode, 1);
48864882
48874883 if (file->f_flags & O_SYNC)
48884884 ext4_handle_sync(handle);
@@ -5569,6 +5565,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) · 680 unmodified lines
55695565 ext4_handle_sync(handle);
55705566 inode->i_mtime = inode->i_ctime = current_time(inode);
55715567 ext4_mark_inode_dirty(handle, inode);
5568+ ext4_update_inode_fsync_trans(handle, inode, 1);
55725569
55735570 out_stop:
55745571 ext4_journal_stop(handle);
@@ -5742,6 +5739,8 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) · 167 unmodified lines
57425739 up_write(&EXT4_I(inode)->i_data_sem);
57435740 if (IS_SYNC(inode))
57445741 ext4_handle_sync(handle);
5742+ if (ret >= 0)
5743+ ext4_update_inode_fsync_trans(handle, inode, 1);
57455744
57465745 out_stop:
57475746 ext4_journal_stop(handle);
fs/ext4/file.c+16−38
@@ -474,57 +474,37 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, · 473 unmodified lines
474474 endoff = (loff_t)end_blk << blkbits;
475475
476476 index = startoff >> PAGE_SHIFT;
477− end = endoff >> PAGE_SHIFT;
477+ end = (endoff - 1) >> PAGE_SHIFT;
478478
479479 pagevec_init(&pvec, 0);
480480 do {
481481 int i, num;
482482 unsigned long nr_pages;
483483
484− num = min_t(pgoff_t, end - index, PAGEVEC_SIZE);
484+ num = min_t(pgoff_t, end - index, PAGEVEC_SIZE - 1) + 1;
485485 nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
486486 (pgoff_t)num);
487− if (nr_pages == 0) {
488− if (whence == SEEK_DATA)
489− break;
490−
491− BUG_ON(whence != SEEK_HOLE);
492− /*
493− * If this is the first time to go into the loop and
494− * offset is not beyond the end offset, it will be a
495− * hole at this offset
496− */
497− if (lastoff == startoff || lastoff < endoff)
498− found = 1;
499− break;
500− }
501−
502− /*
503− * If this is the first time to go into the loop and
504− * offset is smaller than the first page offset, it will be a
505− * hole at this offset.
506− */
507− if (lastoff == startoff && whence == SEEK_HOLE &&
508− lastoff < page_offset(pvec.pages[0])) {
509− found = 1;
487+ if (nr_pages == 0)
510488 break;
511− }
512489
513490 for (i = 0; i < nr_pages; i++) {
514491 struct page *page = pvec.pages[i];
515492 struct buffer_head *bh, *head;
516493
517494 /*
518− * If the current offset is not beyond the end of given
519− * range, it will be a hole.
495+ * If current offset is smaller than the page offset,
496+ * there is a hole at this offset.
520497 */
521− if (lastoff < endoff && whence == SEEK_HOLE &&
522− page->index > end) {
498+ if (whence == SEEK_HOLE && lastoff < endoff &&
499+ lastoff < page_offset(pvec.pages[i])) {
523500 found = 1;
524501 *offset = lastoff;
525502 goto out;
526503 }
527504
505+ if (page->index > end)
506+ goto out;
507+
528508 lock_page(page);
529509
530510 if (unlikely(page->mapping != inode->i_mapping)) {
@@ -564,20 +544,18 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, · 33 unmodified lines
564544 unlock_page(page);
565545 }
566546
567− /*
568− * The no. of pages is less than our desired, that would be a
569− * hole in there.
570− */
571− if (nr_pages < num && whence == SEEK_HOLE) {
572− found = 1;
573− *offset = lastoff;
547+ /* The no. of pages is less than our desired, we are done. */
548+ if (nr_pages < num)
574549 break;
575− }
576550
577551 index = pvec.pages[i - 1]->index + 1;
578552 pagevec_release(&pvec);
579553 } while (index <= end);
580554
555+ if (whence == SEEK_HOLE && lastoff < endoff) {
556+ found = 1;
557+ *offset = lastoff;
558+ }
581559 out:
582560 pagevec_release(&pvec);
583561 return found;
fs/ext4/inline.c+2−3
@@ -1627,7 +1627,6 @@ out: · 1626 unmodified lines
16271627
16281628 struct buffer_head *ext4_find_inline_entry(struct inode *dir,
16291629 struct ext4_filename *fname,
1630− const struct qstr *d_name,
16311630 struct ext4_dir_entry_2 **res_dir,
16321631 int *has_inline_data)
16331632 {
@@ -1649,7 +1648,7 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir, · 15 unmodified lines
16491648 EXT4_INLINE_DOTDOT_SIZE;
16501649 inline_size = EXT4_MIN_INLINE_DATA_SIZE - EXT4_INLINE_DOTDOT_SIZE;
16511650 ret = ext4_search_dir(iloc.bh, inline_start, inline_size,
1652− dir, fname, d_name, 0, res_dir);
1651+ dir, fname, 0, res_dir);
16531652 if (ret == 1)
16541653 goto out_find;
16551654 if (ret < 0)
@@ -1662,7 +1661,7 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir, · 6 unmodified lines
16621661 inline_size = ext4_get_inline_size(dir) - EXT4_MIN_INLINE_DATA_SIZE;
16631662
16641663 ret = ext4_search_dir(iloc.bh, inline_start, inline_size,
1665− dir, fname, d_name, 0, res_dir);
1664+ dir, fname, 0, res_dir);
16661665 if (ret == 1)
16671666 goto out_find;
16681667
fs/ext4/inode.c+22−8
@@ -2124,15 +2124,29 @@ static int ext4_writepage(struct page *page, · 2123 unmodified lines
21242124 static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page)
21252125 {
21262126 int len;
2127− loff_t size = i_size_read(mpd->inode);
2127+ loff_t size;
21282128 int err;
21292129
21302130 BUG_ON(page->index != mpd->first_page);
2131+ clear_page_dirty_for_io(page);
2132+ /*
2133+ * We have to be very careful here! Nothing protects writeback path
2134+ * against i_size changes and the page can be writeably mapped into
2135+ * page tables. So an application can be growing i_size and writing
2136+ * data through mmap while writeback runs. clear_page_dirty_for_io()
2137+ * write-protects our page in page tables and the page cannot get
2138+ * written to again until we release page lock. So only after
2139+ * clear_page_dirty_for_io() we are safe to sample i_size for
2140+ * ext4_bio_write_page() to zero-out tail of the written page. We rely
2141+ * on the barrier provided by TestClearPageDirty in
2142+ * clear_page_dirty_for_io() to make sure i_size is really sampled only
2143+ * after page tables are updated.
2144+ */
2145+ size = i_size_read(mpd->inode);
21312146 if (page->index == size >> PAGE_SHIFT)
21322147 len = size & ~PAGE_MASK;
21332148 else
21342149 len = PAGE_SIZE;
2135− clear_page_dirty_for_io(page);
21362150 err = ext4_bio_write_page(&mpd->io_submit, page, len, mpd->wbc, false);
21372151 if (!err)
21382152 mpd->wbc->nr_to_write--;
@@ -3629,9 +3643,6 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter) · 1490 unmodified lines
36293643 get_block_func = ext4_dio_get_block_unwritten_async;
36303644 dio_flags = DIO_LOCKING;
36313645 }
3632−#ifdef CONFIG_EXT4_FS_ENCRYPTION
3633− BUG_ON(ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode));
3634−#endif
36353646 ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
36363647 get_block_func, ext4_end_io_dio, NULL,
36373648 dio_flags);
@@ -3713,7 +3724,7 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) · 75 unmodified lines
37133724 */
37143725 inode_lock_shared(inode);
37153726 ret = filemap_write_and_wait_range(mapping, iocb->ki_pos,
3716− iocb->ki_pos + count);
3727+ iocb->ki_pos + count - 1);
37173728 if (ret)
37183729 goto out_unlock;
37193730 ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
@@ -4207,6 +4218,8 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) · 487 unmodified lines
42074218
42084219 inode->i_mtime = inode->i_ctime = current_time(inode);
42094220 ext4_mark_inode_dirty(handle, inode);
4221+ if (ret >= 0)
4222+ ext4_update_inode_fsync_trans(handle, inode, 1);
42104223 out_stop:
42114224 ext4_journal_stop(handle);
42124225 out_dio:
@@ -5637,8 +5650,9 @@ static int ext4_expand_extra_isize(struct inode *inode, · 1424 unmodified lines
56375650 /* No extended attributes present */
56385651 if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
56395652 header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) {
5640− memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0,
5641− new_extra_isize);
5653+ memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
5654+ EXT4_I(inode)->i_extra_isize, 0,
5655+ new_extra_isize - EXT4_I(inode)->i_extra_isize);
56425656 EXT4_I(inode)->i_extra_isize = new_extra_isize;
56435657 return 0;
56445658 }
fs/ext4/mballoc.c+14−9
@@ -3887,7 +3887,8 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, · 3886 unmodified lines
38873887
38883888 err = ext4_mb_load_buddy(sb, group, &e4b);
38893889 if (err) {
3890− ext4_error(sb, "Error loading buddy information for %u", group);
3890+ ext4_warning(sb, "Error %d loading buddy information for %u",
3891+ err, group);
38913892 put_bh(bitmap_bh);
38923893 return 0;
38933894 }
@@ -4044,10 +4045,11 @@ repeat: · 150 unmodified lines
40444045 BUG_ON(pa->pa_type != MB_INODE_PA);
40454046 group = ext4_get_group_number(sb, pa->pa_pstart);
40464047
4047− err = ext4_mb_load_buddy(sb, group, &e4b);
4048+ err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
4049+ GFP_NOFS|__GFP_NOFAIL);
40484050 if (err) {
4049− ext4_error(sb, "Error loading buddy information for %u",
4050− group);
4051+ ext4_error(sb, "Error %d loading buddy information for %u",
4052+ err, group);
40514053 continue;
40524054 }
40534055
@@ -4303,11 +4305,14 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb, · 249 unmodified lines
43034305 spin_unlock(&lg->lg_prealloc_lock);
43044306
43054307 list_for_each_entry_safe(pa, tmp, &discard_list, u.pa_tmp_list) {
4308+ int err;
43064309
43074310 group = ext4_get_group_number(sb, pa->pa_pstart);
4308− if (ext4_mb_load_buddy(sb, group, &e4b)) {
4309− ext4_error(sb, "Error loading buddy information for %u",
4310− group);
4311+ err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
4312+ GFP_NOFS|__GFP_NOFAIL);
4313+ if (err) {
4314+ ext4_error(sb, "Error %d loading buddy information for %u",
4315+ err, group);
43114316 continue;
43124317 }
43134318 ext4_lock_group(sb, group);
@@ -5127,8 +5132,8 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group, · 813 unmodified lines
51275132
51285133 ret = ext4_mb_load_buddy(sb, group, &e4b);
51295134 if (ret) {
5130− ext4_error(sb, "Error in loading buddy "
5131− "information for %u", group);
5135+ ext4_warning(sb, "Error %d loading buddy information for %u",
5136+ ret, group);
51325137 return ret;
51335138 }
51345139 bitmap = e4b.bd_bitmap;
fs/ext4/namei.c+5−8
@@ -1155,12 +1155,11 @@ errout: · 1154 unmodified lines
11551155 static inline int search_dirblock(struct buffer_head *bh,
11561156 struct inode *dir,
11571157 struct ext4_filename *fname,
1158− const struct qstr *d_name,
11591158 unsigned int offset,
11601159 struct ext4_dir_entry_2 **res_dir)
11611160 {
11621161 return ext4_search_dir(bh, bh->b_data, dir->i_sb->s_blocksize, dir,
1163− fname, d_name, offset, res_dir);
1162+ fname, offset, res_dir);
11641163 }
11651164
11661165 /*
@@ -1262,7 +1261,6 @@ static inline bool ext4_match(const struct ext4_filename *fname, · 95 unmodified lines
12621261 */
12631262 int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
12641263 struct inode *dir, struct ext4_filename *fname,
1265− const struct qstr *d_name,
12661264 unsigned int offset, struct ext4_dir_entry_2 **res_dir)
12671265 {
12681266 struct ext4_dir_entry_2 * de;
@@ -1355,7 +1353,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, · 86 unmodified lines
13551353
13561354 if (ext4_has_inline_data(dir)) {
13571355 int has_inline_data = 1;
1358− ret = ext4_find_inline_entry(dir, &fname, d_name, res_dir,
1356+ ret = ext4_find_inline_entry(dir, &fname, res_dir,
13591357 &has_inline_data);
13601358 if (has_inline_data) {
13611359 if (inlined)
@@ -1447,7 +1445,7 @@ restart: · 85 unmodified lines
14471445 goto next;
14481446 }
14491447 set_buffer_verified(bh);
1450− i = search_dirblock(bh, dir, &fname, d_name,
1448+ i = search_dirblock(bh, dir, &fname,
14511449 block << EXT4_BLOCK_SIZE_BITS(sb), res_dir);
14521450 if (i == 1) {
14531451 EXT4_I(dir)->i_dir_start_lookup = block;
@@ -1488,7 +1486,6 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 34 unmodified lines
14881486 {
14891487 struct super_block * sb = dir->i_sb;
14901488 struct dx_frame frames[2], *frame;
1491− const struct qstr *d_name = fname->usr_fname;
14921489 struct buffer_head *bh;
14931490 ext4_lblk_t block;
14941491 int retval;
@@ -1505,7 +1502,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 10 unmodified lines
15051502 if (IS_ERR(bh))
15061503 goto errout;
15071504
1508− retval = search_dirblock(bh, dir, fname, d_name,
1505+ retval = search_dirblock(bh, dir, fname,
15091506 block << EXT4_BLOCK_SIZE_BITS(sb),
15101507 res_dir);
15111508 if (retval == 1)
@@ -1530,7 +1527,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 18 unmodified lines
15301527
15311528 bh = NULL;
15321529 errout:
1533− dxtrace(printk(KERN_DEBUG "%s not found\n", d_name->name));
1530+ dxtrace(printk(KERN_DEBUG "%s not found\n", fname->usr_fname->name));
15341531 success:
15351532 dx_release(frames);
15361533 return bh;
fs/ext4/super.c+8−9
@@ -848,14 +848,9 @@ static inline void ext4_quota_off_umount(struct super_block *sb) · 847 unmodified lines
848848 {
849849 int type;
850850
851− if (ext4_has_feature_quota(sb)) {
852− dquot_disable(sb, -1,
853− DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
854− } else {
855− /* Use our quota_off function to clear inode flags etc. */
856− for (type = 0; type < EXT4_MAXQUOTAS; type++)
857− ext4_quota_off(sb, type);
858− }
851+ /* Use our quota_off function to clear inode flags etc. */
852+ for (type = 0; type < EXT4_MAXQUOTAS; type++)
853+ ext4_quota_off(sb, type);
859854 }
860855 #else
861856 static inline void ext4_quota_off_umount(struct super_block *sb)
@@ -1179,6 +1174,9 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, · 317 unmodified lines
11791174 return res;
11801175 }
11811176
1177+ res = dquot_initialize(inode);
1178+ if (res)
1179+ return res;
11821180 retry:
11831181 handle = ext4_journal_start(inode, EXT4_HT_MISC,
11841182 ext4_jbd2_credits_xattr(inode));
@@ -5485,7 +5483,7 @@ static int ext4_quota_off(struct super_block *sb, int type) · 4300 unmodified lines
54855483 goto out;
54865484
54875485 err = dquot_quota_off(sb, type);
5488− if (err)
5486+ if (err || ext4_has_feature_quota(sb))
54895487 goto out_put;
54905488
54915489 inode_lock(inode);
@@ -5505,6 +5503,7 @@ static int ext4_quota_off(struct super_block *sb, int type) · 13 unmodified lines
55055503 out_unlock:
55065504 inode_unlock(inode);
55075505 out_put:
5506+ lockdep_set_quota_inode(inode, I_DATA_SEM_NORMAL);
55085507 iput(inode);
55095508 return err;
55105509 out:
fs/ext4/xattr.c+8−0
@@ -888,6 +888,8 @@ inserted: · 887 unmodified lines
888888 else {
889889 u32 ref;
890890
891+ WARN_ON_ONCE(dquot_initialize_needed(inode));
892+
891893 /* The old block is released after updating
892894 the inode. */
893895 error = dquot_alloc_block(inode,
@@ -954,6 +956,8 @@ inserted: · 60 unmodified lines
954956 /* We need to allocate a new block */
955957 ext4_fsblk_t goal, block;
956958
959+ WARN_ON_ONCE(dquot_initialize_needed(inode));
960+
957961 goal = ext4_group_first_block_no(sb,
958962 EXT4_I(inode)->i_block_group);
959963
@@ -1166,6 +1170,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, · 206 unmodified lines
11661170 return -EINVAL;
11671171 if (strlen(name) > 255)
11681172 return -ERANGE;
1173+
11691174 ext4_write_lock_xattr(inode, &no_expand);
11701175
11711176 error = ext4_reserve_inode_write(handle, inode, &is.iloc);
@@ -1267,6 +1272,9 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name, · 95 unmodified lines
12671272 int error, retries = 0;
12681273 int credits = ext4_jbd2_credits_xattr(inode);
12691274
1275+ error = dquot_initialize(inode);
1276+ if (error)
1277+ return error;
12701278 retry:
12711279 handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits);
12721280 if (IS_ERR(handle)) {
fs/f2fs/f2fs.h+4−1
@@ -1078,6 +1078,7 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 1077 unmodified lines
10781078 {
10791079 SHASH_DESC_ON_STACK(shash, sbi->s_chksum_driver);
10801080 u32 *ctx = (u32 *)shash_desc_ctx(shash);
1081+ u32 retval;
10811082 int err;
10821083
10831084 shash->tfm = sbi->s_chksum_driver;
@@ -1087,7 +1088,9 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 3 unmodified lines
10871088 err = crypto_shash_update(shash, address, length);
10881089 BUG_ON(err);
10891090
1090− return *ctx;
1091+ retval = *ctx;
1092+ barrier_data(ctx);
1093+ return retval;
10911094 }
10921095
10931096 static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc,
fs/jbd2/transaction.c+6−0
@@ -680,6 +680,12 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) · 679 unmodified lines
680680
681681 rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
682682 handle->h_buffer_credits = nblocks;
683+ /*
684+ * Restore the original nofs context because the journal restart
685+ * is basically the same thing as journal stop and start.
686+ * start_this_handle will start a new nofs context.
687+ */
688+ memalloc_nofs_restore(handle->saved_alloc_context);
683689 ret = start_this_handle(journal, handle, gfp_mask);
684690 return ret;
685691 }
fs/quota/dquot.c+16−0
@@ -1512,6 +1512,22 @@ int dquot_initialize(struct inode *inode) · 1511 unmodified lines
15121512 }
15131513 EXPORT_SYMBOL(dquot_initialize);
15141514
1515+bool dquot_initialize_needed(struct inode *inode)
1516+{
1517+ struct dquot **dquots;
1518+ int i;
1519+
1520+ if (!dquot_active(inode))
1521+ return false;
1522+
1523+ dquots = i_dquot(inode);
1524+ for (i = 0; i < MAXQUOTAS; i++)
1525+ if (!dquots[i] && sb_has_quota_active(inode->i_sb, i))
1526+ return true;
1527+ return false;
1528+}
1529+EXPORT_SYMBOL(dquot_initialize_needed);
1530+
15151531 /*
15161532 * Release all quotas referenced by inode.
15171533 *
fs/stat.c+1−0
@@ -672,6 +672,7 @@ void __inode_add_bytes(struct inode *inode, loff_t bytes) · 671 unmodified lines
672672 inode->i_bytes -= 512;
673673 }
674674 }
675+EXPORT_SYMBOL(__inode_add_bytes);
675676
676677 void inode_add_bytes(struct inode *inode, loff_t bytes)
677678 {
fs/ufs/balloc.c+25−1
@@ -82,7 +82,8 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) · 81 unmodified lines
8282 ufs_error (sb, "ufs_free_fragments",
8383 "bit already cleared for fragment %u", i);
8484 }
85−
85+
86+ inode_sub_bytes(inode, count << uspi->s_fshift);
8687 fs32_add(sb, &ucg->cg_cs.cs_nffree, count);
8788 uspi->cs_total.cs_nffree += count;
8889 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count);
@@ -184,6 +185,7 @@ do_more: · 95 unmodified lines
184185 ufs_error(sb, "ufs_free_blocks", "freeing free fragment");
185186 }
186187 ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno);
188+ inode_sub_bytes(inode, uspi->s_fpb << uspi->s_fshift);
187189 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD)
188190 ufs_clusteracct (sb, ucpi, blkno, 1);
189191
@@ -494,6 +496,20 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 304 unmodified lines
494496 return 0;
495497 }
496498
499+static bool try_add_frags(struct inode *inode, unsigned frags)
500+{
501+ unsigned size = frags * i_blocksize(inode);
502+ spin_lock(&inode->i_lock);
503+ __inode_add_bytes(inode, size);
504+ if (unlikely((u32)inode->i_blocks != inode->i_blocks)) {
505+ __inode_sub_bytes(inode, size);
506+ spin_unlock(&inode->i_lock);
507+ return false;
508+ }
509+ spin_unlock(&inode->i_lock);
510+ return true;
511+}
512+
497513 static u64 ufs_add_fragments(struct inode *inode, u64 fragment,
498514 unsigned oldcount, unsigned newcount)
499515 {
@@ -530,6 +546,9 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, · 30 unmodified lines
530546 for (i = oldcount; i < newcount; i++)
531547 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i))
532548 return 0;
549+
550+ if (!try_add_frags(inode, count))
551+ return 0;
533552 /*
534553 * Block can be extended
535554 */
@@ -647,6 +666,7 @@ cg_found: · 111 unmodified lines
647666 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i);
648667 i = uspi->s_fpb - count;
649668
669+ inode_sub_bytes(inode, i << uspi->s_fshift);
650670 fs32_add(sb, &ucg->cg_cs.cs_nffree, i);
651671 uspi->cs_total.cs_nffree += i;
652672 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i);
@@ -657,6 +677,8 @@ cg_found: · 4 unmodified lines
657677 result = ufs_bitmap_search (sb, ucpi, goal, allocsize);
658678 if (result == INVBLOCK)
659679 return 0;
680+ if (!try_add_frags(inode, count))
681+ return 0;
660682 for (i = 0; i < count; i++)
661683 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i);
662684
@@ -716,6 +738,8 @@ norot: · 53 unmodified lines
716738 return INVBLOCK;
717739 ucpi->c_rotor = result;
718740 gotit:
741+ if (!try_add_frags(inode, uspi->s_fpb))
742+ return 0;
719743 blkno = ufs_fragstoblks(result);
720744 ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno);
721745 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD)
fs/ufs/inode.c+12−16
@@ -235,7 +235,8 @@ ufs_extend_tail(struct inode *inode, u64 writes_to, · 234 unmodified lines
235235
236236 p = ufs_get_direct_data_ptr(uspi, ufsi, block);
237237 tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p),
238− new_size, err, locked_page);
238+ new_size - (lastfrag & uspi->s_fpbmask), err,
239+ locked_page);
239240 return tmp != 0;
240241 }
241242
@@ -284,7 +285,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index, · 42 unmodified lines
284285 goal += uspi->s_fpb;
285286 }
286287 tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment),
287− goal, uspi->s_fpb, err, locked_page);
288+ goal, nfrags, err, locked_page);
288289
289290 if (!tmp) {
290291 *err = -ENOSPC;
@@ -402,7 +403,9 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff · 111 unmodified lines
402403
403404 if (!create) {
404405 phys64 = ufs_frag_map(inode, offsets, depth);
405− goto out;
406+ if (phys64)
407+ map_bh(bh_result, sb, phys64 + frag);
408+ return 0;
406409 }
407410
408411 /* This code entered only while writing ....? */
@@ -841,8 +844,11 @@ void ufs_evict_inode(struct inode * inode) · 432 unmodified lines
841844 truncate_inode_pages_final(&inode->i_data);
842845 if (want_delete) {
843846 inode->i_size = 0;
844− if (inode->i_blocks)
847+ if (inode->i_blocks &&
848+ (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
849+ S_ISLNK(inode->i_mode)))
845850 ufs_truncate_blocks(inode);
851+ ufs_update_inode(inode, inode_needs_sync(inode));
846852 }
847853
848854 invalidate_inode_buffers(inode);
@@ -1100,7 +1106,7 @@ out: · 251 unmodified lines
11001106 return err;
11011107 }
11021108
1103−static void __ufs_truncate_blocks(struct inode *inode)
1109+static void ufs_truncate_blocks(struct inode *inode)
11041110 {
11051111 struct ufs_inode_info *ufsi = UFS_I(inode);
11061112 struct super_block *sb = inode->i_sb;
@@ -1183,7 +1189,7 @@ static int ufs_truncate(struct inode *inode, loff_t size) · 76 unmodified lines
11831189
11841190 truncate_setsize(inode, size);
11851191
1186− __ufs_truncate_blocks(inode);
1192+ ufs_truncate_blocks(inode);
11871193 inode->i_mtime = inode->i_ctime = current_time(inode);
11881194 mark_inode_dirty(inode);
11891195 out:
@@ -1191,16 +1197,6 @@ out: · 1 unmodified line
11911197 return err;
11921198 }
11931199
1194−static void ufs_truncate_blocks(struct inode *inode)
1195−{
1196− if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1197− S_ISLNK(inode->i_mode)))
1198− return;
1199− if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
1200− return;
1201− __ufs_truncate_blocks(inode);
1202−}
1203−
12041200 int ufs_setattr(struct dentry *dentry, struct iattr *attr)
12051201 {
12061202 struct inode *inode = d_inode(dentry);
fs/ufs/super.c+18−0
@@ -746,6 +746,23 @@ static void ufs_put_super(struct super_block *sb) · 745 unmodified lines
746746 return;
747747 }
748748
749+static u64 ufs_max_bytes(struct super_block *sb)
750+{
751+ struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
752+ int bits = uspi->s_apbshift;
753+ u64 res;
754+
755+ if (bits > 21)
756+ res = ~0ULL;
757+ else
758+ res = UFS_NDADDR + (1LL << bits) + (1LL << (2*bits)) +
759+ (1LL << (3*bits));
760+
761+ if (res >= (MAX_LFS_FILESIZE >> uspi->s_bshift))
762+ return MAX_LFS_FILESIZE;
763+ return res << uspi->s_bshift;
764+}
765+
749766 static int ufs_fill_super(struct super_block *sb, void *data, int silent)
750767 {
751768 struct ufs_sb_info * sbi;
@@ -1211,6 +1228,7 @@ magic_found: · 459 unmodified lines
12111228 "fast symlink size (%u)\n", uspi->s_maxsymlinklen);
12121229 uspi->s_maxsymlinklen = maxsymlen;
12131230 }
1231+ sb->s_maxbytes = ufs_max_bytes(sb);
12141232 sb->s_max_links = UFS_LINK_MAX;
12151233
12161234 inode = ufs_iget(sb, UFS_ROOTINO);
fs/ufs/util.h+7−3
@@ -473,15 +473,19 @@ static inline unsigned _ubh_find_last_zero_bit_( · 472 unmodified lines
473473 static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi,
474474 struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
475475 {
476+ u8 mask;
476477 switch (uspi->s_fpb) {
477478 case 8:
478479 return (*ubh_get_addr (ubh, begin + block) == 0xff);
479480 case 4:
480− return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2)));
481+ mask = 0x0f << ((block & 0x01) << 2);
482+ return (*ubh_get_addr (ubh, begin + (block >> 1)) & mask) == mask;
481483 case 2:
482− return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1)));
484+ mask = 0x03 << ((block & 0x03) << 1);
485+ return (*ubh_get_addr (ubh, begin + (block >> 2)) & mask) == mask;
483486 case 1:
484− return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07)));
487+ mask = 0x01 << (block & 0x07);
488+ return (*ubh_get_addr (ubh, begin + (block >> 3)) & mask) == mask;
485489 }
486490 return 0;
487491 }
include/acpi/actbl.h+14−0
@@ -374,6 +374,20 @@ struct acpi_table_desc { · 373 unmodified lines
374374 u16 validation_count;
375375 };
376376
377+/*
378+ * Maximum value of the validation_count field in struct acpi_table_desc.
379+ * When reached, validation_count cannot be changed any more and the table will
380+ * be permanently regarded as validated.
381+ *
382+ * This is to prevent situations in which unbalanced table get/put operations
383+ * may cause premature table unmapping in the OS to happen.
384+ *
385+ * The maximum validation count can be defined to any value, but should be
386+ * greater than the maximum number of OS early stage mapping slots to avoid
387+ * leaking early stage table mappings to the late stage.
388+ */
389+#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX
390+
377391 /* Masks for Flags field above */
378392
379393 #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */
include/linux/compiler-clang.h+2−1
@@ -21,4 +21,5 @@ · 20 unmodified lines
2121 * -Wunused-function. This turns out to avoid the need for complex #ifdef
2222 * directives. Suppress the warning in clang as well.
2323 */
24−#define inline inline __attribute__((unused))
24+#undef inline
25+#define inline inline __attribute__((unused)) notrace
include/linux/dma-iommu.h+1−0
@@ -78,6 +78,7 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); · 77 unmodified lines
7878
7979 struct iommu_domain;
8080 struct msi_msg;
81+struct device;
8182
8283 static inline int iommu_dma_init(void)
8384 {
include/linux/elevator.h+1−1
@@ -153,7 +153,7 @@ struct elevator_type · 152 unmodified lines
153153 #endif
154154
155155 /* managed by elevator core */
156− char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */
156+ char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */
157157 struct list_head list;
158158 };
159159
include/linux/irqchip/arm-gic-v3.h+4−0
@@ -417,6 +417,10 @@ · 416 unmodified lines
417417 #define ICH_HCR_EN (1 << 0)
418418 #define ICH_HCR_UIE (1 << 1)
419419
420+#define ICH_VMCR_ACK_CTL_SHIFT 2
421+#define ICH_VMCR_ACK_CTL_MASK (1 << ICH_VMCR_ACK_CTL_SHIFT)
422+#define ICH_VMCR_FIQ_EN_SHIFT 3
423+#define ICH_VMCR_FIQ_EN_MASK (1 << ICH_VMCR_FIQ_EN_SHIFT)
420424 #define ICH_VMCR_CBPR_SHIFT 4
421425 #define ICH_VMCR_CBPR_MASK (1 << ICH_VMCR_CBPR_SHIFT)
422426 #define ICH_VMCR_EOIM_SHIFT 9
include/linux/irqchip/arm-gic.h+25−3
@@ -25,7 +25,18 @@ · 24 unmodified lines
2525 #define GICC_ENABLE 0x1
2626 #define GICC_INT_PRI_THRESHOLD 0xf0
2727
28−#define GIC_CPU_CTRL_EOImodeNS (1 << 9)
28+#define GIC_CPU_CTRL_EnableGrp0_SHIFT 0
29+#define GIC_CPU_CTRL_EnableGrp0 (1 << GIC_CPU_CTRL_EnableGrp0_SHIFT)
30+#define GIC_CPU_CTRL_EnableGrp1_SHIFT 1
31+#define GIC_CPU_CTRL_EnableGrp1 (1 << GIC_CPU_CTRL_EnableGrp1_SHIFT)
32+#define GIC_CPU_CTRL_AckCtl_SHIFT 2
33+#define GIC_CPU_CTRL_AckCtl (1 << GIC_CPU_CTRL_AckCtl_SHIFT)
34+#define GIC_CPU_CTRL_FIQEn_SHIFT 3
35+#define GIC_CPU_CTRL_FIQEn (1 << GIC_CPU_CTRL_FIQEn_SHIFT)
36+#define GIC_CPU_CTRL_CBPR_SHIFT 4
37+#define GIC_CPU_CTRL_CBPR (1 << GIC_CPU_CTRL_CBPR_SHIFT)
38+#define GIC_CPU_CTRL_EOImodeNS_SHIFT 9
39+#define GIC_CPU_CTRL_EOImodeNS (1 << GIC_CPU_CTRL_EOImodeNS_SHIFT)
2940
3041 #define GICC_IAR_INT_ID_MASK 0x3ff
3142 #define GICC_INT_SPURIOUS 1023
@@ -84,8 +95,19 @@ · 52 unmodified lines
8495 #define GICH_LR_EOI (1 << 19)
8596 #define GICH_LR_HW (1 << 31)
8697
87−#define GICH_VMCR_CTRL_SHIFT 0
88−#define GICH_VMCR_CTRL_MASK (0x21f << GICH_VMCR_CTRL_SHIFT)
98+#define GICH_VMCR_ENABLE_GRP0_SHIFT 0
99+#define GICH_VMCR_ENABLE_GRP0_MASK (1 << GICH_VMCR_ENABLE_GRP0_SHIFT)
100+#define GICH_VMCR_ENABLE_GRP1_SHIFT 1
101+#define GICH_VMCR_ENABLE_GRP1_MASK (1 << GICH_VMCR_ENABLE_GRP1_SHIFT)
102+#define GICH_VMCR_ACK_CTL_SHIFT 2
103+#define GICH_VMCR_ACK_CTL_MASK (1 << GICH_VMCR_ACK_CTL_SHIFT)
104+#define GICH_VMCR_FIQ_EN_SHIFT 3
105+#define GICH_VMCR_FIQ_EN_MASK (1 << GICH_VMCR_FIQ_EN_SHIFT)
106+#define GICH_VMCR_CBPR_SHIFT 4
107+#define GICH_VMCR_CBPR_MASK (1 << GICH_VMCR_CBPR_SHIFT)
108+#define GICH_VMCR_EOI_MODE_SHIFT 9
109+#define GICH_VMCR_EOI_MODE_MASK (1 << GICH_VMCR_EOI_MODE_SHIFT)
110+
89111 #define GICH_VMCR_PRIMASK_SHIFT 27
90112 #define GICH_VMCR_PRIMASK_MASK (0x1f << GICH_VMCR_PRIMASK_SHIFT)
91113 #define GICH_VMCR_BINPOINT_SHIFT 21
include/linux/key.h+0−1
@@ -173,7 +173,6 @@ struct key { · 172 unmodified lines
173173 #ifdef KEY_DEBUGGING
174174 unsigned magic;
175175 #define KEY_DEBUG_MAGIC 0x18273645u
176−#define KEY_DEBUG_MAGIC_X 0xf8e9dacbu
177176 #endif
178177
179178 unsigned long flags; /* status flags (change with bitops) */
include/linux/netdevice.h+10−5
@@ -914,8 +914,7 @@ struct xfrmdev_ops { · 913 unmodified lines
914914 *
915915 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
916916 * Called when a user wants to change the Maximum Transfer Unit
917− * of a device. If not defined, any request to change MTU will
918− * will return an error.
917+ * of a device.
919918 *
920919 * void (*ndo_tx_timeout)(struct net_device *dev);
921920 * Callback used when the transmitter has not made any progress
@@ -1596,8 +1595,8 @@ enum netdev_priv_flags { · 674 unmodified lines
15961595 * @rtnl_link_state: This enum represents the phases of creating
15971596 * a new link
15981597 *
1599− * @destructor: Called from unregister,
1600− * can be used to call free_netdev
1598+ * @needs_free_netdev: Should unregister perform free_netdev?
1599+ * @priv_destructor: Called from unregister
16011600 * @npinfo: XXX: need comments on this one
16021601 * @nd_net: Network namespace this network device is inside
16031602 *
@@ -1858,7 +1857,8 @@ struct net_device { · 254 unmodified lines
18581857 RTNL_LINK_INITIALIZING,
18591858 } rtnl_link_state:16;
18601859
1861− void (*destructor)(struct net_device *dev);
1860+ bool needs_free_netdev;
1861+ void (*priv_destructor)(struct net_device *dev);
18621862
18631863 #ifdef CONFIG_NETPOLL
18641864 struct netpoll_info __rcu *npinfo;
@@ -4264,6 +4264,11 @@ static inline const char *netdev_name(const struct net_device *dev) · 2399 unmodified lines
42644264 return dev->name;
42654265 }
42664266
4267+static inline bool netdev_unregistering(const struct net_device *dev)
4268+{
4269+ return dev->reg_state == NETREG_UNREGISTERING;
4270+}
4271+
42674272 static inline const char *netdev_reg_state(const struct net_device *dev)
42684273 {
42694274 switch (dev->reg_state) {
include/linux/quotaops.h+6−0
@@ -44,6 +44,7 @@ void inode_sub_rsv_space(struct inode *inode, qsize_t number); · 43 unmodified lines
4444 void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
4545
4646 int dquot_initialize(struct inode *inode);
47+bool dquot_initialize_needed(struct inode *inode);
4748 void dquot_drop(struct inode *inode);
4849 struct dquot *dqget(struct super_block *sb, struct kqid qid);
4950 static inline struct dquot *dqgrab(struct dquot *dquot)
@@ -207,6 +208,11 @@ static inline int dquot_initialize(struct inode *inode) · 157 unmodified lines
207208 return 0;
208209 }
209210
211+static inline bool dquot_initialize_needed(struct inode *inode)
212+{
213+ return false;
214+}
215+
210216 static inline void dquot_drop(struct inode *inode)
211217 {
212218 }
include/linux/srcu.h+0−2
@@ -172,9 +172,7 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) · 171 unmodified lines
172172 {
173173 int retval;
174174
175− preempt_disable();
176175 retval = __srcu_read_lock(sp);
177− preempt_enable();
178176 rcu_lock_acquire(&(sp)->dep_map);
179177 return retval;
180178 }
include/linux/suspend.h+2−5
@@ -189,8 +189,6 @@ struct platform_suspend_ops { · 188 unmodified lines
189189 struct platform_freeze_ops {
190190 int (*begin)(void);
191191 int (*prepare)(void);
192− void (*wake)(void);
193− void (*sync)(void);
194192 void (*restore)(void);
195193 void (*end)(void);
196194 };
@@ -430,8 +428,7 @@ extern unsigned int pm_wakeup_irq; · 233 unmodified lines
430428
431429 extern bool pm_wakeup_pending(void);
432430 extern void pm_system_wakeup(void);
433−extern void pm_system_cancel_wakeup(void);
434−extern void pm_wakeup_clear(bool reset);
431+extern void pm_wakeup_clear(void);
435432 extern void pm_system_irq_wakeup(unsigned int irq_number);
436433 extern bool pm_get_wakeup_count(unsigned int *count, bool block);
437434 extern bool pm_save_wakeup_count(unsigned int count);
@@ -481,7 +478,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) · 43 unmodified lines
481478
482479 static inline bool pm_wakeup_pending(void) { return false; }
483480 static inline void pm_system_wakeup(void) {}
484−static inline void pm_wakeup_clear(bool reset) {}
481+static inline void pm_wakeup_clear(void) {}
485482 static inline void pm_system_irq_wakeup(unsigned int irq_number) {}
486483
487484 static inline void lock_system_sleep(void) {}
include/media/cec-notifier.h+10−0
@@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, · 105 unmodified lines
106106 {
107107 }
108108
109+static inline void cec_notifier_register(struct cec_notifier *n,
110+ struct cec_adapter *adap,
111+ void (*callback)(struct cec_adapter *adap, u16 pa))
112+{
113+}
114+
115+static inline void cec_notifier_unregister(struct cec_notifier *n)
116+{
117+}
118+
109119 #endif
110120
111121 #endif
include/media/cec.h+1−1
@@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) · 205 unmodified lines
206206 #define cec_phys_addr_exp(pa) \
207207 ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
208208
209−#if IS_ENABLED(CONFIG_CEC_CORE)
209+#if IS_REACHABLE(CONFIG_CEC_CORE)
210210 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
211211 void *priv, const char *name, u32 caps, u8 available_las);
212212 int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
include/uapi/linux/ethtool.h+4−2
@@ -1486,8 +1486,10 @@ enum ethtool_link_mode_bit_indices { · 1485 unmodified lines
14861486 * it was forced up into this mode or autonegotiated.
14871487 */
14881488
1489−/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1490−/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */
1489+/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
1490+ * Update drivers/net/phy/phy.c:phy_speed_to_str() and
1491+ * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
1492+ */
14911493 #define SPEED_10 10
14921494 #define SPEED_100 100
14931495 #define SPEED_1000 1000
include/uapi/linux/keyctl.h+2−2
@@ -70,8 +70,8 @@ struct keyctl_dh_params { · 69 unmodified lines
7070 };
7171
7272 struct keyctl_kdf_params {
73− char *hashname;
74− char *otherinfo;
73+ char __user *hashname;
74+ char __user *otherinfo;
7575 __u32 otherinfolen;
7676 __u32 __spare[8];
7777 };
include/uapi/linux/openvswitch.h+1−0
@@ -343,6 +343,7 @@ enum ovs_key_attr { · 342 unmodified lines
343343 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
344344
345345 enum ovs_tunnel_key_attr {
346+ /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */
346347 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
347348 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
348349 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
kernel/cpu.c+2−2
@@ -1658,13 +1658,13 @@ static ssize_t write_cpuhp_target(struct device *dev, · 1657 unmodified lines
16581658 ret = !sp->name || sp->cant_stop ? -EINVAL : 0;
16591659 mutex_unlock(&cpuhp_state_mutex);
16601660 if (ret)
1661− return ret;
1661+ goto out;
16621662
16631663 if (st->state < target)
16641664 ret = do_cpu_up(dev->id, target);
16651665 else
16661666 ret = do_cpu_down(dev->id, target);
1667−
1667+out:
16681668 unlock_device_hotplug();
16691669 return ret ? ret : count;
16701670 }
kernel/events/core.c+21−0
@@ -7329,6 +7329,21 @@ int perf_event_account_interrupt(struct perf_event *event) · 7328 unmodified lines
73297329 return __perf_event_account_interrupt(event, 1);
73307330 }
73317331
7332+static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs)
7333+{
7334+ /*
7335+ * Due to interrupt latency (AKA "skid"), we may enter the
7336+ * kernel before taking an overflow, even if the PMU is only
7337+ * counting user events.
7338+ * To avoid leaking information to userspace, we must always
7339+ * reject kernel samples when exclude_kernel is set.
7340+ */
7341+ if (event->attr.exclude_kernel && !user_mode(regs))
7342+ return false;
7343+
7344+ return true;
7345+}
7346+
73327347 /*
73337348 * Generic event overflow handling, sampling.
73347349 */
@@ -7349,6 +7364,12 @@ static int __perf_event_overflow(struct perf_event *event, · 14 unmodified lines
73497364
73507365 ret = __perf_event_account_interrupt(event, throttle);
73517366
7367+ /*
7368+ * For security, drop the skid kernel samples if necessary.
7369+ */
7370+ if (!sample_is_allowed(event, regs))
7371+ return ret;
7372+
73527373 /*
73537374 * XXX event_limit might not quite work as expected on inherited
73547375 * events
kernel/power/process.c+1−1
@@ -132,7 +132,7 @@ int freeze_processes(void) · 131 unmodified lines
132132 if (!pm_freezing)
133133 atomic_inc(&system_freezing_cnt);
134134
135− pm_wakeup_clear(true);
135+ pm_wakeup_clear();
136136 pr_info("Freezing user space processes ... ");
137137 pm_freezing = true;
138138 error = try_to_freeze_tasks(true);
kernel/power/suspend.c+4−25
@@ -72,8 +72,6 @@ static void freeze_begin(void) · 71 unmodified lines
7272
7373 static void freeze_enter(void)
7474 {
75− trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, true);
76−
7775 spin_lock_irq(&suspend_freeze_lock);
7876 if (pm_wakeup_pending())
7977 goto out;
@@ -100,27 +98,6 @@ static void freeze_enter(void) · 20 unmodified lines
10098 out:
10199 suspend_freeze_state = FREEZE_STATE_NONE;
102100 spin_unlock_irq(&suspend_freeze_lock);
103−
104− trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, false);
105−}
106−
107−static void s2idle_loop(void)
108−{
109− do {
110− freeze_enter();
111−
112− if (freeze_ops && freeze_ops->wake)
113− freeze_ops->wake();
114−
115− dpm_resume_noirq(PMSG_RESUME);
116− if (freeze_ops && freeze_ops->sync)
117− freeze_ops->sync();
118−
119− if (pm_wakeup_pending())
120− break;
121−
122− pm_wakeup_clear(false);
123− } while (!dpm_suspend_noirq(PMSG_SUSPEND));
124101 }
125102
126103 void freeze_wake(void)
@@ -394,8 +371,10 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) · 267 unmodified lines
394371 * all the devices are suspended.
395372 */
396373 if (state == PM_SUSPEND_FREEZE) {
397− s2idle_loop();
398− goto Platform_early_resume;
374+ trace_suspend_resume(TPS("machine_suspend"), state, true);
375+ freeze_enter();
376+ trace_suspend_resume(TPS("machine_suspend"), state, false);
377+ goto Platform_wake;
399378 }
400379
401380 error = disable_nonboot_cpus();
kernel/printk/printk.c+10−36
@@ -269,7 +269,6 @@ static struct console *exclusive_console; · 268 unmodified lines
269269 #define MAX_CMDLINECONSOLES 8
270270
271271 static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
272−static int console_cmdline_cnt;
273272
274273 static int preferred_console = -1;
275274 int console_set_on_cmdline;
@@ -1906,25 +1905,12 @@ static int __add_preferred_console(char *name, int idx, char *options, · 1630 unmodified lines
19061905 * See if this tty is not yet registered, and
19071906 * if we have a slot free.
19081907 */
1909− for (i = 0, c = console_cmdline; i < console_cmdline_cnt; i++, c++) {
1908+ for (i = 0, c = console_cmdline;
1909+ i < MAX_CMDLINECONSOLES && c->name[0];
1910+ i++, c++) {
19101911 if (strcmp(c->name, name) == 0 && c->index == idx) {
1911− if (brl_options)
1912− return 0;
1913−
1914− /*
1915− * Maintain an invariant that will help to find if
1916− * the matching console is preferred, see
1917− * register_console():
1918− *
1919− * The last non-braille console is always
1920− * the preferred one.
1921− */
1922− if (i != console_cmdline_cnt - 1)
1923− swap(console_cmdline[i],
1924− console_cmdline[console_cmdline_cnt - 1]);
1925−
1926− preferred_console = console_cmdline_cnt - 1;
1927−
1912+ if (!brl_options)
1913+ preferred_console = i;
19281914 return 0;
19291915 }
19301916 }
@@ -1937,7 +1923,6 @@ static int __add_preferred_console(char *name, int idx, char *options, · 6 unmodified lines
19371923 braille_set_options(c, brl_options);
19381924
19391925 c->index = idx;
1940− console_cmdline_cnt++;
19411926 return 0;
19421927 }
19431928 /*
@@ -2477,23 +2462,12 @@ void register_console(struct console *newcon) · 533 unmodified lines
24772462 }
24782463
24792464 /*
2480− * See if this console matches one we selected on the command line.
2481− *
2482− * There may be several entries in the console_cmdline array matching
2483− * with the same console, one with newcon->match(), another by
2484− * name/index:
2485− *
2486− * pl011,mmio,0x87e024000000,115200 -- added from SPCR
2487− * ttyAMA0 -- added from command line
2488− *
2489− * Traverse the console_cmdline array in reverse order to be
2490− * sure that if this console is preferred then it will be the first
2491− * matching entry. We use the invariant that is maintained in
2492− * __add_preferred_console().
2465+ * See if this console matches one we selected on
2466+ * the command line.
24932467 */
2494− for (i = console_cmdline_cnt - 1; i >= 0; i--) {
2495− c = console_cmdline + i;
2496−
2468+ for (i = 0, c = console_cmdline;
2469+ i < MAX_CMDLINECONSOLES && c->name[0];
2470+ i++, c++) {
24972471 if (!newcon->match ||
24982472 newcon->match(newcon, c->name, c->index, c->options) != 0) {
24992473 /* default matching */
kernel/rcu/srcu.c+2−3
@@ -263,7 +263,7 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 262 unmodified lines
263263
264264 /*
265265 * Counts the new reader in the appropriate per-CPU element of the
266− * srcu_struct. Must be called from process context.
266+ * srcu_struct.
267267 * Returns an index that must be passed to the matching srcu_read_unlock().
268268 */
269269 int __srcu_read_lock(struct srcu_struct *sp)
@@ -271,7 +271,7 @@ int __srcu_read_lock(struct srcu_struct *sp) · 1 unmodified line
271271 int idx;
272272
273273 idx = READ_ONCE(sp->completed) & 0x1;
274− __this_cpu_inc(sp->per_cpu_ref->lock_count[idx]);
274+ this_cpu_inc(sp->per_cpu_ref->lock_count[idx]);
275275 smp_mb(); /* B */ /* Avoid leaking the critical section. */
276276 return idx;
277277 }
@@ -281,7 +281,6 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 3 unmodified lines
281281 * Removes the count for the old reader from the appropriate per-CPU
282282 * element of the srcu_struct. Note that this may well be a different
283283 * CPU than that which was incremented by the corresponding srcu_read_lock().
284− * Must be called from process context.
285284 */
286285 void __srcu_read_unlock(struct srcu_struct *sp, int idx)
287286 {
kernel/rcu/srcutiny.c+4−3
@@ -97,8 +97,9 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 96 unmodified lines
9797
9898 /*
9999 * Counts the new reader in the appropriate per-CPU element of the
100− * srcu_struct. Must be called from process context.
101− * Returns an index that must be passed to the matching srcu_read_unlock().
100+ * srcu_struct. Can be invoked from irq/bh handlers, but the matching
101+ * __srcu_read_unlock() must be in the same handler instance. Returns an
102+ * index that must be passed to the matching srcu_read_unlock().
102103 */
103104 int __srcu_read_lock(struct srcu_struct *sp)
104105 {
@@ -112,7 +113,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 7 unmodified lines
112113
113114 /*
114115 * Removes the count for the old reader from the appropriate element of
115− * the srcu_struct. Must be called from process context.
116+ * the srcu_struct.
116117 */
117118 void __srcu_read_unlock(struct srcu_struct *sp, int idx)
118119 {
kernel/rcu/srcutree.c+2−3
@@ -357,7 +357,7 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 356 unmodified lines
357357
358358 /*
359359 * Counts the new reader in the appropriate per-CPU element of the
360− * srcu_struct. Must be called from process context.
360+ * srcu_struct.
361361 * Returns an index that must be passed to the matching srcu_read_unlock().
362362 */
363363 int __srcu_read_lock(struct srcu_struct *sp)
@@ -365,7 +365,7 @@ int __srcu_read_lock(struct srcu_struct *sp) · 1 unmodified line
365365 int idx;
366366
367367 idx = READ_ONCE(sp->srcu_idx) & 0x1;
368− __this_cpu_inc(sp->sda->srcu_lock_count[idx]);
368+ this_cpu_inc(sp->sda->srcu_lock_count[idx]);
369369 smp_mb(); /* B */ /* Avoid leaking the critical section. */
370370 return idx;
371371 }
@@ -375,7 +375,6 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 3 unmodified lines
375375 * Removes the count for the old reader from the appropriate per-CPU
376376 * element of the srcu_struct. Note that this may well be a different
377377 * CPU than that which was incremented by the corresponding srcu_read_lock().
378− * Must be called from process context.
379378 */
380379 void __srcu_read_unlock(struct srcu_struct *sp, int idx)
381380 {
kernel/sched/cpufreq_schedutil.c+0−3
@@ -101,9 +101,6 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 100 unmodified lines
101101 if (sg_policy->next_freq == next_freq)
102102 return;
103103
104− if (sg_policy->next_freq > next_freq)
105− next_freq = (sg_policy->next_freq + next_freq) >> 1;
106−
107104 sg_policy->next_freq = next_freq;
108105 sg_policy->last_freq_update_time = time;
109106
lib/libcrc32c.c+4−2
@@ -43,7 +43,7 @@ static struct crypto_shash *tfm; · 42 unmodified lines
4343 u32 crc32c(u32 crc, const void *address, unsigned int length)
4444 {
4545 SHASH_DESC_ON_STACK(shash, tfm);
46− u32 *ctx = (u32 *)shash_desc_ctx(shash);
46+ u32 ret, *ctx = (u32 *)shash_desc_ctx(shash);
4747 int err;
4848
4949 shash->tfm = tfm;
@@ -53,7 +53,9 @@ u32 crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines
5353 err = crypto_shash_update(shash, address, length);
5454 BUG_ON(err);
5555
56− return *ctx;
56+ ret = *ctx;
57+ barrier_data(ctx);
58+ return ret;
5759 }
5860
5961 EXPORT_SYMBOL(crc32c);
net/8021q/vlan_dev.c+2−2
@@ -807,7 +807,6 @@ static void vlan_dev_free(struct net_device *dev) · 806 unmodified lines
807807
808808 free_percpu(vlan->vlan_pcpu_stats);
809809 vlan->vlan_pcpu_stats = NULL;
810− free_netdev(dev);
811810 }
812811
813812 void vlan_setup(struct net_device *dev)
@@ -820,7 +819,8 @@ void vlan_setup(struct net_device *dev) · 6 unmodified lines
820819 netif_keep_dst(dev);
821820
822821 dev->netdev_ops = &vlan_netdev_ops;
823− dev->destructor = vlan_dev_free;
822+ dev->needs_free_netdev = true;
823+ dev->priv_destructor = vlan_dev_free;
824824 dev->ethtool_ops = &vlan_ethtool_ops;
825825
826826 dev->min_mtu = 0;
net/batman-adv/distributed-arp-table.c+3−2
@@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 1063 unmodified lines
10641064
10651065 skb_new->protocol = eth_type_trans(skb_new, soft_iface);
10661066
1067− soft_iface->stats.rx_packets++;
1068− soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
1067+ batadv_inc_counter(bat_priv, BATADV_CNT_RX);
1068+ batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
1069+ skb->len + ETH_HLEN + hdr_size);
10691070
10701071 netif_rx(skb_new);
10711072 batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
net/batman-adv/routing.c+1−1
@@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 986 unmodified lines
987987 batadv_dbg(BATADV_DBG_BLA, bat_priv,
988988 "%s(): Dropped unicast pkt received from another backbone gw %pM.\n",
989989 __func__, orig_addr_gw);
990− return NET_RX_DROP;
990+ goto free_skb;
991991 }
992992 }
993993
net/batman-adv/soft-interface.c+2−3
@@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) · 1033 unmodified lines
10341034 * netdev and its private data (bat_priv)
10351035 */
10361036 rcu_barrier();
1037−
1038− free_netdev(dev);
10391037 }
10401038
10411039 /**
@@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) · 5 unmodified lines
10471045 ether_setup(dev);
10481046
10491047 dev->netdev_ops = &batadv_netdev_ops;
1050− dev->destructor = batadv_softif_free;
1048+ dev->needs_free_netdev = true;
1049+ dev->priv_destructor = batadv_softif_free;
10511050 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
10521051 dev->priv_flags |= IFF_NO_QUEUE;
10531052
net/bluetooth/6lowpan.c+1−1
@@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) · 597 unmodified lines
598598
599599 dev->netdev_ops = &netdev_ops;
600600 dev->header_ops = &header_ops;
601− dev->destructor = free_netdev;
601+ dev->needs_free_netdev = true;
602602 }
603603
604604 static struct device_type bt_type = {
net/bridge/br_device.c+1−1
@@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) · 378 unmodified lines
379379 ether_setup(dev);
380380
381381 dev->netdev_ops = &br_netdev_ops;
382− dev->destructor = free_netdev;
382+ dev->needs_free_netdev = true;
383383 dev->ethtool_ops = &br_ethtool_ops;
384384 SET_NETDEV_DEVTYPE(dev, &br_type);
385385 dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
net/caif/caif_socket.c+4−0
@@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, · 753 unmodified lines
754754
755755 lock_sock(sk);
756756
757+ err = -EINVAL;
758+ if (addr_len < offsetofend(struct sockaddr, sa_family))
759+ goto out;
760+
757761 err = -EAFNOSUPPORT;
758762 if (uaddr->sa_family != AF_CAIF)
759763 goto out;
net/caif/cfpkt_skbuff.c+1−5
@@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) · 80 unmodified lines
8181 {
8282 struct sk_buff *skb;
8383
84− if (likely(in_interrupt()))
85− skb = alloc_skb(len + pfx, GFP_ATOMIC);
86− else
87− skb = alloc_skb(len + pfx, GFP_KERNEL);
88−
84+ skb = alloc_skb(len + pfx, GFP_ATOMIC);
8985 if (unlikely(skb == NULL))
9086 return NULL;
9187
net/caif/chnl_net.c+2−2
@@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) · 391 unmodified lines
392392 {
393393 struct chnl_net *priv = netdev_priv(dev);
394394 caif_free_client(&priv->chnl);
395− free_netdev(dev);
396395 }
397396
398397 static void ipcaif_net_setup(struct net_device *dev)
399398 {
400399 struct chnl_net *priv;
401400 dev->netdev_ops = &netdev_ops;
402− dev->destructor = chnl_net_destructor;
401+ dev->needs_free_netdev = true;
402+ dev->priv_destructor = chnl_net_destructor;
403403 dev->flags |= IFF_NOARP;
404404 dev->flags |= IFF_POINTOPOINT;
405405 dev->mtu = GPRS_PDP_MTU;
net/can/af_can.c+1−2
@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, · 871 unmodified lines
872872
873873 static int can_pernet_init(struct net *net)
874874 {
875− net->can.can_rcvlists_lock =
876− __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock);
875+ spin_lock_init(&net->can.can_rcvlists_lock);
877876 net->can.can_rx_alldev_list =
878877 kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL);
879878
net/core/dev.c+30−12
@@ -1281,8 +1281,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) · 1280 unmodified lines
12811281 if (!new_ifalias)
12821282 return -ENOMEM;
12831283 dev->ifalias = new_ifalias;
1284+ memcpy(dev->ifalias, alias, len);
1285+ dev->ifalias[len] = 0;
12841286
1285− strlcpy(dev->ifalias, alias, len+1);
12861287 return len;
12871288 }
12881289
@@ -5026,6 +5027,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) · 3737 unmodified lines
50265027 }
50275028 EXPORT_SYMBOL(__skb_gro_checksum_complete);
50285029
5030+static void net_rps_send_ipi(struct softnet_data *remsd)
5031+{
5032+#ifdef CONFIG_RPS
5033+ while (remsd) {
5034+ struct softnet_data *next = remsd->rps_ipi_next;
5035+
5036+ if (cpu_online(remsd->cpu))
5037+ smp_call_function_single_async(remsd->cpu, &remsd->csd);
5038+ remsd = next;
5039+ }
5040+#endif
5041+}
5042+
50295043 /*
50305044 * net_rps_action_and_irq_enable sends any pending IPI's for rps.
50315045 * Note: called with local irq disabled, but exits with local irq enabled.
@@ -5041,14 +5055,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) · 9 unmodified lines
50415055 local_irq_enable();
50425056
50435057 /* Send pending IPI's to kick RPS processing on remote cpus. */
5044− while (remsd) {
5045− struct softnet_data *next = remsd->rps_ipi_next;
5046−
5047− if (cpu_online(remsd->cpu))
5048− smp_call_function_single_async(remsd->cpu,
5049− &remsd->csd);
5050− remsd = next;
5051− }
5058+ net_rps_send_ipi(remsd);
50525059 } else
50535060 #endif
50545061 local_irq_enable();
@@ -7579,6 +7586,8 @@ out: · 2524 unmodified lines
75797586 err_uninit:
75807587 if (dev->netdev_ops->ndo_uninit)
75817588 dev->netdev_ops->ndo_uninit(dev);
7589+ if (dev->priv_destructor)
7590+ dev->priv_destructor(dev);
75827591 goto out;
75837592 }
75847593 EXPORT_SYMBOL(register_netdevice);
@@ -7786,8 +7795,10 @@ void netdev_run_todo(void) · 201 unmodified lines
77867795 WARN_ON(rcu_access_pointer(dev->ip6_ptr));
77877796 WARN_ON(dev->dn_ptr);
77887797
7789− if (dev->destructor)
7790− dev->destructor(dev);
7798+ if (dev->priv_destructor)
7799+ dev->priv_destructor(dev);
7800+ if (dev->needs_free_netdev)
7801+ free_netdev(dev);
77917802
77927803 /* Report a network device has been unregistered */
77937804 rtnl_lock();
@@ -8270,7 +8281,7 @@ static int dev_cpu_dead(unsigned int oldcpu) · 476 unmodified lines
82708281 struct sk_buff **list_skb;
82718282 struct sk_buff *skb;
82728283 unsigned int cpu;
8273− struct softnet_data *sd, *oldsd;
8284+ struct softnet_data *sd, *oldsd, *remsd = NULL;
82748285
82758286 local_irq_disable();
82768287 cpu = smp_processor_id();
@@ -8311,6 +8322,13 @@ static int dev_cpu_dead(unsigned int oldcpu) · 34 unmodified lines
83118322 raise_softirq_irqoff(NET_TX_SOFTIRQ);
83128323 local_irq_enable();
83138324
8325+#ifdef CONFIG_RPS
8326+ remsd = oldsd->rps_ipi_list;
8327+ oldsd->rps_ipi_list = NULL;
8328+#endif
8329+ /* send out pending IPI's on offline CPU */
8330+ net_rps_send_ipi(remsd);
8331+
83148332 /* Process offline CPU's input_pkt_queue */
83158333 while ((skb = __skb_dequeue(&oldsd->process_queue))) {
83168334 netif_rx_ni(skb);
net/core/dst.c+14−0
@@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, · 468 unmodified lines
469469 spin_lock_bh(&dst_garbage.lock);
470470 dst = dst_garbage.list;
471471 dst_garbage.list = NULL;
472+ /* The code in dst_ifdown places a hold on the loopback device.
473+ * If the gc entry processing is set to expire after a lengthy
474+ * interval, this hold can cause netdev_wait_allrefs() to hang
475+ * out and wait for a long time -- until the the loopback
476+ * interface is released. If we're really unlucky, it'll emit
477+ * pr_emerg messages to console too. Reset the interval here,
478+ * so dst cleanups occur in a more timely fashion.
479+ */
480+ if (dst_garbage.timer_inc > DST_GC_INC) {
481+ dst_garbage.timer_inc = DST_GC_INC;
482+ dst_garbage.timer_expires = DST_GC_MIN;
483+ mod_delayed_work(system_wq, &dst_gc_work,
484+ dst_garbage.timer_expires);
485+ }
472486 spin_unlock_bh(&dst_garbage.lock);
473487
474488 if (last)
net/core/rtnetlink.c+2−1
@@ -1125,6 +1125,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 1124 unmodified lines
11251125 struct ifla_vf_mac vf_mac;
11261126 struct ifla_vf_info ivi;
11271127
1128+ memset(&ivi, 0, sizeof(ivi));
1129+
11281130 /* Not all SR-IOV capable drivers support the
11291131 * spoofcheck and "RSS query enable" query. Preset to
11301132 * -1 so the user space tool can detect that the driver
@@ -1133,7 +1135,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 2 unmodified lines
11331135 ivi.spoofchk = -1;
11341136 ivi.rss_query_en = -1;
11351137 ivi.trusted = -1;
1136− memset(ivi.mac, 0, sizeof(ivi.mac));
11371138 /* The default value for VF link state is "auto"
11381139 * IFLA_VF_LINK_STATE_AUTO which equals zero
11391140 */
net/decnet/netfilter/dn_rtmsg.c+3−1
@@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) · 101 unmodified lines
102102 {
103103 struct nlmsghdr *nlh = nlmsg_hdr(skb);
104104
105− if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
105+ if (skb->len < sizeof(*nlh) ||
106+ nlh->nlmsg_len < sizeof(*nlh) ||
107+ skb->len < nlh->nlmsg_len)
106108 return;
107109
108110 if (!netlink_capable(skb, CAP_NET_ADMIN))
net/hsr/hsr_device.c+2−2
@@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 377 unmodified lines
378378 del_timer_sync(&hsr->announce_timer);
379379
380380 synchronize_rcu();
381− free_netdev(hsr_dev);
382381 }
383382
384383 static const struct net_device_ops hsr_device_ops = {
@@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) · 19 unmodified lines
404403 SET_NETDEV_DEVTYPE(dev, &hsr_type);
405404 dev->priv_flags |= IFF_NO_QUEUE;
406405
407− dev->destructor = hsr_dev_destroy;
406+ dev->needs_free_netdev = true;
407+ dev->priv_destructor = hsr_dev_destroy;
408408
409409 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
410410 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
net/hsr/hsr_forward.c+1−2
@@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, · 323 unmodified lines
324324 unsigned long irqflags;
325325
326326 frame->is_supervision = is_supervision_frame(port->hsr, skb);
327− frame->node_src = hsr_get_node(&port->hsr->node_db, skb,
328− frame->is_supervision);
327+ frame->node_src = hsr_get_node(port, skb, frame->is_supervision);
329328 if (frame->node_src == NULL)
330329 return -1; /* Unknown node and !is_supervision, or no mem */
331330
net/hsr/hsr_framereg.c+7−2
@@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], · 157 unmodified lines
158158
159159 /* Get the hsr_node from which 'skb' was sent.
160160 */
161−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
161+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
162162 bool is_sup)
163163 {
164+ struct list_head *node_db = &port->hsr->node_db;
164165 struct hsr_node *node;
165166 struct ethhdr *ethhdr;
166167 u16 seq_out;
@@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, · 19 unmodified lines
186187 */
187188 seq_out = hsr_get_skb_sequence_nr(skb) - 1;
188189 } else {
189− WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190+ /* this is called also for frames from master port and
191+ * so warn only for non master ports
192+ */
193+ if (port->type != HSR_PT_MASTER)
194+ WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190195 seq_out = HSR_SEQNR_START;
191196 }
192197
net/hsr/hsr_framereg.h+1−1
@@ -18,7 +18,7 @@ struct hsr_node; · 17 unmodified lines
1818
1919 struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
2020 u16 seq_out);
21−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
21+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
2222 bool is_sup);
2323 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
2424 struct hsr_port *port);
net/ieee802154/6lowpan/core.c+1−1
@@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) · 106 unmodified lines
107107
108108 ldev->netdev_ops = &lowpan_netdev_ops;
109109 ldev->header_ops = &lowpan_header_ops;
110− ldev->destructor = free_netdev;
110+ ldev->needs_free_netdev = true;
111111 ldev->features |= NETIF_F_NETNS_LOCAL;
112112 }
113113
net/ipv4/icmp.c+6−2
@@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 656 unmodified lines
657657 /* Needed by both icmp_global_allow and icmp_xmit_lock */
658658 local_bh_disable();
659659
660− /* Check global sysctl_icmp_msgs_per_sec ratelimit */
661− if (!icmpv4_global_allow(net, type, code))
660+ /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless
661+ * incoming dev is loopback. If outgoing dev change to not be
662+ * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow)
663+ */
664+ if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) &&
665+ !icmpv4_global_allow(net, type, code))
662666 goto out_bh_enable;
663667
664668 sk = icmp_xmit_lock(net);
net/ipv4/igmp.c+13−8
@@ -2071,21 +2071,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, · 2070 unmodified lines
20712071
20722072 static void ip_mc_clear_src(struct ip_mc_list *pmc)
20732073 {
2074− struct ip_sf_list *psf, *nextpsf;
2074+ struct ip_sf_list *psf, *nextpsf, *tomb, *sources;
20752075
2076− for (psf = pmc->tomb; psf; psf = nextpsf) {
2076+ spin_lock_bh(&pmc->lock);
2077+ tomb = pmc->tomb;
2078+ pmc->tomb = NULL;
2079+ sources = pmc->sources;
2080+ pmc->sources = NULL;
2081+ pmc->sfmode = MCAST_EXCLUDE;
2082+ pmc->sfcount[MCAST_INCLUDE] = 0;
2083+ pmc->sfcount[MCAST_EXCLUDE] = 1;
2084+ spin_unlock_bh(&pmc->lock);
2085+
2086+ for (psf = tomb; psf; psf = nextpsf) {
20772087 nextpsf = psf->sf_next;
20782088 kfree(psf);
20792089 }
2080− pmc->tomb = NULL;
2081− for (psf = pmc->sources; psf; psf = nextpsf) {
2090+ for (psf = sources; psf; psf = nextpsf) {
20822091 nextpsf = psf->sf_next;
20832092 kfree(psf);
20842093 }
2085− pmc->sources = NULL;
2086− pmc->sfmode = MCAST_EXCLUDE;
2087− pmc->sfcount[MCAST_INCLUDE] = 0;
2088− pmc->sfcount[MCAST_EXCLUDE] = 1;
20892094 }
20902095
20912096 /* Join a multicast group
net/ipv4/ip_tunnel.c+2−2
@@ -967,7 +967,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) · 966 unmodified lines
967967 gro_cells_destroy(&tunnel->gro_cells);
968968 dst_cache_destroy(&tunnel->dst_cache);
969969 free_percpu(dev->tstats);
970− free_netdev(dev);
971970 }
972971
973972 void ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
@@ -1155,7 +1154,8 @@ int ip_tunnel_init(struct net_device *dev) · 181 unmodified lines
11551154 struct iphdr *iph = &tunnel->parms.iph;
11561155 int err;
11571156
1158− dev->destructor = ip_tunnel_dev_free;
1157+ dev->needs_free_netdev = true;
1158+ dev->priv_destructor = ip_tunnel_dev_free;
11591159 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
11601160 if (!dev->tstats)
11611161 return -ENOMEM;
net/ipv4/ipmr.c+16−18
@@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); · 100 unmodified lines
101101 static void ipmr_free_table(struct mr_table *mrt);
102102
103103 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
104− struct sk_buff *skb, struct mfc_cache *cache,
105− int local);
104+ struct net_device *dev, struct sk_buff *skb,
105+ struct mfc_cache *cache, int local);
106106 static int ipmr_cache_report(struct mr_table *mrt,
107107 struct sk_buff *pkt, vifi_t vifi, int assert);
108108 static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
@@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) · 392 unmodified lines
501501 dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8;
502502 dev->flags = IFF_NOARP;
503503 dev->netdev_ops = &reg_vif_netdev_ops;
504− dev->destructor = free_netdev;
504+ dev->needs_free_netdev = true;
505505 dev->features |= NETIF_F_NETNS_LOCAL;
506506 }
507507
@@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, · 480 unmodified lines
988988
989989 rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
990990 } else {
991− ip_mr_forward(net, mrt, skb, c, 0);
991+ ip_mr_forward(net, mrt, skb->dev, skb, c, 0);
992992 }
993993 }
994994 }
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, · 78 unmodified lines
10731073
10741074 /* Queue a packet for resolution. It gets locked cache entry! */
10751075 static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,
1076− struct sk_buff *skb)
1076+ struct sk_buff *skb, struct net_device *dev)
10771077 {
10781078 const struct iphdr *iph = ip_hdr(skb);
10791079 struct mfc_cache *c;
@@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, · 50 unmodified lines
11301130 kfree_skb(skb);
11311131 err = -ENOBUFS;
11321132 } else {
1133+ if (dev) {
1134+ skb->dev = dev;
1135+ skb->skb_iif = dev->ifindex;
1136+ }
11331137 skb_queue_tail(&c->mfc_un.unres.unresolved, skb);
11341138 err = 0;
11351139 }
@@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) · 692 unmodified lines
18281832
18291833 /* "local" means that we should preserve one skb (for local delivery) */
18301834 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
1831− struct sk_buff *skb, struct mfc_cache *cache,
1832− int local)
1835+ struct net_device *dev, struct sk_buff *skb,
1836+ struct mfc_cache *cache, int local)
18331837 {
1834− int true_vifi = ipmr_find_vif(mrt, skb->dev);
1838+ int true_vifi = ipmr_find_vif(mrt, dev);
18351839 int psend = -1;
18361840 int vif, ct;
18371841
@@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, · 15 unmodified lines
18531857 }
18541858
18551859 /* Wrong interface: drop packet and (maybe) send PIM assert. */
1856− if (mrt->vif_table[vif].dev != skb->dev) {
1857− struct net_device *mdev;
1858−
1859− mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev);
1860− if (mdev == skb->dev)
1861− goto forward;
1862−
1860+ if (mrt->vif_table[vif].dev != dev) {
18631861 if (rt_is_output_route(skb_rtable(skb))) {
18641862 /* It is our own packet, looped back.
18651863 * Very complicated situation...
@@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) · 187 unmodified lines
20532051 read_lock(&mrt_lock);
20542052 vif = ipmr_find_vif(mrt, dev);
20552053 if (vif >= 0) {
2056− int err2 = ipmr_cache_unresolved(mrt, vif, skb);
2054+ int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev);
20572055 read_unlock(&mrt_lock);
20582056
20592057 return err2;
@@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) · 4 unmodified lines
20642062 }
20652063
20662064 read_lock(&mrt_lock);
2067− ip_mr_forward(net, mrt, skb, cache, local);
2065+ ip_mr_forward(net, mrt, dev, skb, cache, local);
20682066 read_unlock(&mrt_lock);
20692067
20702068 if (local)
@@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, · 167 unmodified lines
22382236 iph->saddr = saddr;
22392237 iph->daddr = daddr;
22402238 iph->version = 0;
2241− err = ipmr_cache_unresolved(mrt, vif, skb2);
2239+ err = ipmr_cache_unresolved(mrt, vif, skb2, dev);
22422240 read_unlock(&mrt_lock);
22432241 rcu_read_unlock();
22442242 return err;
net/ipv6/icmp.c+1−1
@@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 490 unmodified lines
491491 local_bh_disable();
492492
493493 /* Check global sysctl_icmp_msgs_per_sec ratelimit */
494− if (!icmpv6_global_allow(type))
494+ if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type))
495495 goto out_bh_enable;
496496
497497 mip6_addr_swap(skb);
net/ipv6/ila/ila_xlat.c+1−0
@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) · 61 unmodified lines
6262 {
6363 u32 *v = (u32 *)loc.v32;
6464
65+ __ila_hash_secret_init();
6566 return jhash_2words(v[0], v[1], hashrnd);
6667 }
6768
net/ipv6/ip6_gre.c+5−4
@@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) · 990 unmodified lines
991991
992992 dst_cache_destroy(&t->dst_cache);
993993 free_percpu(dev->tstats);
994− free_netdev(dev);
995994 }
996995
997996 static void ip6gre_tunnel_setup(struct net_device *dev)
998997 {
999998 dev->netdev_ops = &ip6gre_netdev_ops;
1000− dev->destructor = ip6gre_dev_free;
999+ dev->needs_free_netdev = true;
1000+ dev->priv_destructor = ip6gre_dev_free;
10011001
10021002 dev->type = ARPHRD_IP6GRE;
10031003
@@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) · 144 unmodified lines
11481148 return 0;
11491149
11501150 err_reg_dev:
1151− ip6gre_dev_free(ign->fb_tunnel_dev);
1151+ free_netdev(ign->fb_tunnel_dev);
11521152 err_alloc_dev:
11531153 return err;
11541154 }
@@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) · 145 unmodified lines
13001300 ether_setup(dev);
13011301
13021302 dev->netdev_ops = &ip6gre_tap_netdev_ops;
1303− dev->destructor = ip6gre_dev_free;
1303+ dev->needs_free_netdev = true;
1304+ dev->priv_destructor = ip6gre_dev_free;
13041305
13051306 dev->features |= NETIF_F_NETNS_LOCAL;
13061307 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
net/ipv6/ip6_tunnel.c+4−4
@@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) · 253 unmodified lines
254254 gro_cells_destroy(&t->gro_cells);
255255 dst_cache_destroy(&t->dst_cache);
256256 free_percpu(dev->tstats);
257− free_netdev(dev);
258257 }
259258
260259 static int ip6_tnl_create2(struct net_device *dev)
@@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) · 61 unmodified lines
322321 return t;
323322
324323 failed_free:
325− ip6_dev_free(dev);
324+ free_netdev(dev);
326325 failed:
327326 return ERR_PTR(err);
328327 }
@@ -1777,7 +1776,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { · 1448 unmodified lines
17771776 static void ip6_tnl_dev_setup(struct net_device *dev)
17781777 {
17791778 dev->netdev_ops = &ip6_tnl_netdev_ops;
1780− dev->destructor = ip6_dev_free;
1779+ dev->needs_free_netdev = true;
1780+ dev->priv_destructor = ip6_dev_free;
17811781
17821782 dev->type = ARPHRD_TUNNEL6;
17831783 dev->flags |= IFF_NOARP;
@@ -2224,7 +2224,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) · 440 unmodified lines
22242224 return 0;
22252225
22262226 err_register:
2227− ip6_dev_free(ip6n->fb_tnl_dev);
2227+ free_netdev(ip6n->fb_tnl_dev);
22282228 err_alloc_dev:
22292229 return err;
22302230 }
net/ipv6/ip6_vti.c+4−4
@@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) · 179 unmodified lines
180180 static void vti6_dev_free(struct net_device *dev)
181181 {
182182 free_percpu(dev->tstats);
183− free_netdev(dev);
184183 }
185184
186185 static int vti6_tnl_create2(struct net_device *dev)
@@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p · 48 unmodified lines
235234 return t;
236235
237236 failed_free:
238− vti6_dev_free(dev);
237+ free_netdev(dev);
239238 failed:
240239 return NULL;
241240 }
@@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { · 600 unmodified lines
842841 static void vti6_dev_setup(struct net_device *dev)
843842 {
844843 dev->netdev_ops = &vti6_netdev_ops;
845− dev->destructor = vti6_dev_free;
844+ dev->needs_free_netdev = true;
845+ dev->priv_destructor = vti6_dev_free;
846846
847847 dev->type = ARPHRD_TUNNEL6;
848848 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
@@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) · 251 unmodified lines
11001100 return 0;
11011101
11021102 err_register:
1103− vti6_dev_free(ip6n->fb_tnl_dev);
1103+ free_netdev(ip6n->fb_tnl_dev);
11041104 err_alloc_dev:
11051105 return err;
11061106 }
net/ipv6/ip6mr.c+1−1
@@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) · 732 unmodified lines
733733 dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8;
734734 dev->flags = IFF_NOARP;
735735 dev->netdev_ops = &reg_vif_netdev_ops;
736− dev->destructor = free_netdev;
736+ dev->needs_free_netdev = true;
737737 dev->features |= NETIF_F_NETNS_LOCAL;
738738 }
739739
net/ipv6/proc.c+1−1
@@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, · 218 unmodified lines
219219 u64 buff64[SNMP_MIB_MAX];
220220 int i;
221221
222− memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX);
222+ memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX);
223223
224224 snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff);
225225 for (i = 0; itemlist[i].name; i++)
net/ipv6/route.c+1−0
@@ -2832,6 +2832,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) · 2831 unmodified lines
28322832 if ((rt->dst.dev == dev || !dev) &&
28332833 rt != adn->net->ipv6.ip6_null_entry &&
28342834 (rt->rt6i_nsiblings == 0 ||
2835+ (dev && netdev_unregistering(dev)) ||
28352836 !rt->rt6i_idev->cnf.ignore_routes_with_linkdown))
28362837 return -1;
28372838
net/ipv6/sit.c+3−3
@@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 264 unmodified lines
265265 return nt;
266266
267267 failed_free:
268− ipip6_dev_free(dev);
268+ free_netdev(dev);
269269 failed:
270270 return NULL;
271271 }
@@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) · 1064 unmodified lines
13361336
13371337 dst_cache_destroy(&tunnel->dst_cache);
13381338 free_percpu(dev->tstats);
1339− free_netdev(dev);
13401339 }
13411340
13421341 #define SIT_FEATURES (NETIF_F_SG | \
@@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) · 8 unmodified lines
13511350 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
13521351
13531352 dev->netdev_ops = &ipip6_netdev_ops;
1354− dev->destructor = ipip6_dev_free;
1353+ dev->needs_free_netdev = true;
1354+ dev->priv_destructor = ipip6_dev_free;
13551355
13561356 dev->type = ARPHRD_SIT;
13571357 dev->hard_header_len = LL_MAX_HEADER + t_hlen;
net/irda/irlan/irlan_eth.c+1−1
@@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) · 64 unmodified lines
6565 ether_setup(dev);
6666
6767 dev->netdev_ops = &irlan_eth_netdev_ops;
68− dev->destructor = free_netdev;
68+ dev->needs_free_netdev = true;
6969 dev->min_mtu = 0;
7070 dev->max_mtu = ETH_MAX_MTU;
7171
net/l2tp/l2tp_eth.c+8−7
@@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, · 113 unmodified lines
114114 {
115115 struct l2tp_eth *priv = netdev_priv(dev);
116116
117− stats->tx_bytes = atomic_long_read(&priv->tx_bytes);
118− stats->tx_packets = atomic_long_read(&priv->tx_packets);
119− stats->tx_dropped = atomic_long_read(&priv->tx_dropped);
120− stats->rx_bytes = atomic_long_read(&priv->rx_bytes);
121− stats->rx_packets = atomic_long_read(&priv->rx_packets);
122− stats->rx_errors = atomic_long_read(&priv->rx_errors);
117+ stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes);
118+ stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets);
119+ stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped);
120+ stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes);
121+ stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets);
122+ stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors);
123+
123124 }
124125
125126 static const struct net_device_ops l2tp_eth_netdev_ops = {
@@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) · 15 unmodified lines
141142 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
142143 dev->features |= NETIF_F_LLTX;
143144 dev->netdev_ops = &l2tp_eth_netdev_ops;
144− dev->destructor = free_netdev;
145+ dev->needs_free_netdev = true;
145146 }
146147
147148 static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len)
net/mac80211/cfg.c+2−0
@@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 901 unmodified lines
902902 default:
903903 return -EINVAL;
904904 }
905+ sdata->u.ap.req_smps = sdata->smps_mode;
906+
905907 sdata->needed_rx_chains = sdata->local->rx_chains;
906908
907909 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
net/mac80211/ieee80211_i.h+1−1
@@ -1523,7 +1523,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1522 unmodified lines
15231523 return true;
15241524 /* can't handle non-legacy preamble yet */
15251525 if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
1526− status->encoding != RX_ENC_LEGACY)
1526+ status->encoding == RX_ENC_LEGACY)
15271527 return true;
15281528 return false;
15291529 }
net/mac80211/iface.c+4−3
@@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { · 1212 unmodified lines
12131213 static void ieee80211_if_free(struct net_device *dev)
12141214 {
12151215 free_percpu(dev->tstats);
1216− free_netdev(dev);
12171216 }
12181217
12191218 static void ieee80211_if_setup(struct net_device *dev)
@@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) · 1 unmodified line
12211220 ether_setup(dev);
12221221 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
12231222 dev->netdev_ops = &ieee80211_dataif_ops;
1224− dev->destructor = ieee80211_if_free;
1223+ dev->needs_free_netdev = true;
1224+ dev->priv_destructor = ieee80211_if_free;
12251225 }
12261226
12271227 static void ieee80211_if_setup_no_queue(struct net_device *dev)
@@ -1795,6 +1795,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 567 unmodified lines
17951795 ret = dev_alloc_name(ndev, ndev->name);
17961796 if (ret < 0) {
17971797 ieee80211_if_free(ndev);
1798+ free_netdev(ndev);
17981799 return ret;
17991800 }
18001801
@@ -1884,7 +1885,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 83 unmodified lines
18841885
18851886 ret = register_netdevice(ndev);
18861887 if (ret) {
1887− ieee80211_if_free(ndev);
1888+ free_netdev(ndev);
18881889 return ret;
18891890 }
18901891 }
net/mac80211/mlme.c+31−31
@@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 600 unmodified lines
601601 struct ieee80211_supported_band *sband;
602602 struct ieee80211_chanctx_conf *chanctx_conf;
603603 struct ieee80211_channel *chan;
604− u32 rate_flags, rates = 0;
604+ u32 rates = 0;
605605
606606 sdata_assert_lock(sdata);
607607
@@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 4 unmodified lines
612612 return;
613613 }
614614 chan = chanctx_conf->def.chan;
615− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
616615 rcu_read_unlock();
617616 sband = local->hw.wiphy->bands[chan->band];
618617 shift = ieee80211_vif_get_shift(&sdata->vif);
@@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 17 unmodified lines
636635 */
637636 rates_len = 0;
638637 for (i = 0; i < sband->n_bitrates; i++) {
639− if ((rate_flags & sband->bitrates[i].flags)
640− != rate_flags)
641− continue;
642638 rates |= BIT(i);
643639 rates_len++;
644640 }
@@ -2817,7 +2813,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 2172 unmodified lines
28172813 u32 *rates, u32 *basic_rates,
28182814 bool *have_higher_than_11mbit,
28192815 int *min_rate, int *min_rate_index,
2820− int shift, u32 rate_flags)
2816+ int shift)
28212817 {
28222818 int i, j;
28232819
@@ -2845,8 +2841,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 21 unmodified lines
28452841 int brate;
28462842
28472843 br = &sband->bitrates[j];
2848− if ((rate_flags & br->flags) != rate_flags)
2849− continue;
28502844
28512845 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5);
28522846 if (brate == rate) {
@@ -4397,40 +4391,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1544 unmodified lines
43974391 return -ENOMEM;
43984392 }
43994393
4400− if (new_sta || override) {
4401− err = ieee80211_prep_channel(sdata, cbss);
4402− if (err) {
4403− if (new_sta)
4404− sta_info_free(local, new_sta);
4405− return -EINVAL;
4406− }
4407− }
4408−
4394+ /*
4395+ * Set up the information for the new channel before setting the
4396+ * new channel. We can't - completely race-free - change the basic
4397+ * rates bitmap and the channel (sband) that it refers to, but if
4398+ * we set it up before we at least avoid calling into the driver's
4399+ * bss_info_changed() method with invalid information (since we do
4400+ * call that from changing the channel - only for IDLE and perhaps
4401+ * some others, but ...).
4402+ *
4403+ * So to avoid that, just set up all the new information before the
4404+ * channel, but tell the driver to apply it only afterwards, since
4405+ * it might need the new channel for that.
4406+ */
44094407 if (new_sta) {
44104408 u32 rates = 0, basic_rates = 0;
44114409 bool have_higher_than_11mbit;
44124410 int min_rate = INT_MAX, min_rate_index = -1;
4413− struct ieee80211_chanctx_conf *chanctx_conf;
44144411 const struct cfg80211_bss_ies *ies;
44154412 int shift = ieee80211_vif_get_shift(&sdata->vif);
4416− u32 rate_flags;
4417−
4418− rcu_read_lock();
4419− chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
4420− if (WARN_ON(!chanctx_conf)) {
4421− rcu_read_unlock();
4422− sta_info_free(local, new_sta);
4423− return -EINVAL;
4424− }
4425− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
4426− rcu_read_unlock();
44274413
44284414 ieee80211_get_rates(sband, bss->supp_rates,
44294415 bss->supp_rates_len,
44304416 &rates, &basic_rates,
44314417 &have_higher_than_11mbit,
44324418 &min_rate, &min_rate_index,
4433− shift, rate_flags);
4419+ shift);
44344420
44354421 /*
44364422 * This used to be a workaround for basic rates missing
@@ -4488,8 +4474,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 51 unmodified lines
44884474 sdata->vif.bss_conf.sync_dtim_count = 0;
44894475 }
44904476 rcu_read_unlock();
4477+ }
44914478
4492− /* tell driver about BSSID, basic rates and timing */
4479+ if (new_sta || override) {
4480+ err = ieee80211_prep_channel(sdata, cbss);
4481+ if (err) {
4482+ if (new_sta)
4483+ sta_info_free(local, new_sta);
4484+ return -EINVAL;
4485+ }
4486+ }
4487+
4488+ if (new_sta) {
4489+ /*
4490+ * tell driver about BSSID, basic rates and timing
4491+ * this was set up above, before setting the channel
4492+ */
44934493 ieee80211_bss_info_change_notify(sdata,
44944494 BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES |
44954495 BSS_CHANGED_BEACON_INT);
net/mac80211/rx.c+5−1
@@ -1611,12 +1611,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) · 1610 unmodified lines
16111611 */
16121612 if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) &&
16131613 !ieee80211_has_morefrags(hdr->frame_control) &&
1614+ !ieee80211_is_back_req(hdr->frame_control) &&
16141615 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
16151616 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
16161617 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
1617− /* PM bit is only checked in frames where it isn't reserved,
1618+ /*
1619+ * PM bit is only checked in frames where it isn't reserved,
16181620 * in AP mode it's reserved in non-bufferable management frames
16191621 * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field)
1622+ * BAR frames should be ignored as specified in
1623+ * IEEE 802.11-2012 10.2.1.2.
16201624 */
16211625 (!ieee80211_is_mgmt(hdr->frame_control) ||
16221626 ieee80211_is_bufferable_mmpdu(hdr->frame_control))) {
net/mac80211/wpa.c+5−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/unaligned.h>
1818 #include <net/mac80211.h>
1919 #include <crypto/aes.h>
20+#include <crypto/algapi.h>
2021
2122 #include "ieee80211_i.h"
2223 #include "michael.h"
@@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) · 130 unmodified lines
153154 data_len = skb->len - hdrlen - MICHAEL_MIC_LEN;
154155 key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY];
155156 michael_mic(key, hdr, data, data_len, mic);
156− if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0)
157+ if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN))
157158 goto mic_fail;
158159
159160 /* remove Michael MIC from payload */
@@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) · 888 unmodified lines
10481049 bip_aad(skb, aad);
10491050 ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad,
10501051 skb->data + 24, skb->len - 24, mic);
1051− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1052+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
10521053 key->u.aes_cmac.icverrors++;
10531054 return RX_DROP_UNUSABLE;
10541055 }
@@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) · 43 unmodified lines
10981099 bip_aad(skb, aad);
10991100 ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
11001101 skb->data + 24, skb->len - 24, mic);
1101− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1102+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
11021103 key->u.aes_cmac.icverrors++;
11031104 return RX_DROP_UNUSABLE;
11041105 }
@@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) · 97 unmodified lines
12021203 if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
12031204 skb->data + 24, skb->len - 24,
12041205 mic) < 0 ||
1205− memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1206+ crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
12061207 key->u.aes_gmac.icverrors++;
12071208 return RX_DROP_UNUSABLE;
12081209 }
net/mac802154/iface.c+3−4
@@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) · 525 unmodified lines
526526 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
527527
528528 mac802154_llsec_destroy(&sdata->sec);
529−
530− free_netdev(dev);
531529 }
532530
533531 static void ieee802154_if_setup(struct net_device *dev)
@@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 59 unmodified lines
593591 sdata->dev->dev_addr);
594592
595593 sdata->dev->header_ops = &mac802154_header_ops;
596− sdata->dev->destructor = mac802154_wpan_free;
594+ sdata->dev->needs_free_netdev = true;
595+ sdata->dev->priv_destructor = mac802154_wpan_free;
597596 sdata->dev->netdev_ops = &mac802154_wpan_ops;
598597 sdata->dev->ml_priv = &mac802154_mlme_wpan;
599598 wpan_dev->promiscuous_mode = false;
@@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 8 unmodified lines
608607
609608 break;
610609 case NL802154_IFTYPE_MONITOR:
611− sdata->dev->destructor = free_netdev;
610+ sdata->dev->needs_free_netdev = true;
612611 sdata->dev->netdev_ops = &mac802154_monitor_ops;
613612 wpan_dev->promiscuous_mode = true;
614613 break;
net/openvswitch/vport-internal_dev.c+2−2
@@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) · 93 unmodified lines
9494 struct vport *vport = ovs_internal_dev_get_vport(dev);
9595
9696 ovs_vport_free(vport);
97− free_netdev(dev);
9897 }
9998
10099 static void
@@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) · 55 unmodified lines
156155 netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
157156 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
158157 IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
159− netdev->destructor = internal_dev_destructor;
158+ netdev->needs_free_netdev = true;
159+ netdev->priv_destructor = internal_dev_destructor;
160160 netdev->ethtool_ops = &internal_dev_ethtool_ops;
161161 netdev->rtnl_link_ops = &internal_dev_link_ops;
162162
net/phonet/pep-gprs.c+1−1
@@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) · 235 unmodified lines
236236 dev->tx_queue_len = 10;
237237
238238 dev->netdev_ops = &gprs_netdev_ops;
239− dev->destructor = free_netdev;
239+ dev->needs_free_netdev = true;
240240 }
241241
242242 /*
net/sched/act_pedit.c+3−1
@@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, · 93 unmodified lines
9494 k++;
9595 }
9696
97− if (n)
97+ if (n) {
98+ err = -EINVAL;
9899 goto err_out;
100+ }
99101
100102 return keys_ex;
101103
net/sched/act_police.c+3−5
@@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 131 unmodified lines
132132 }
133133 }
134134
135− spin_lock_bh(&police->tcf_lock);
136135 if (est) {
137136 err = gen_replace_estimator(&police->tcf_bstats, NULL,
138137 &police->tcf_rate_est,
139138 &police->tcf_lock,
140139 NULL, est);
141140 if (err)
142− goto failure_unlock;
141+ goto failure;
143142 } else if (tb[TCA_POLICE_AVRATE] &&
144143 (ret == ACT_P_CREATED ||
145144 !gen_estimator_active(&police->tcf_rate_est))) {
146145 err = -EINVAL;
147− goto failure_unlock;
146+ goto failure;
148147 }
149148
149+ spin_lock_bh(&police->tcf_lock);
150150 /* No failure allowed after this point */
151151 police->tcfp_mtu = parm->mtu;
152152 if (police->tcfp_mtu == 0) {
@@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 39 unmodified lines
192192
193193 return ret;
194194
195−failure_unlock:
196− spin_unlock_bh(&police->tcf_lock);
197195 failure:
198196 qdisc_put_rtab(P_tab);
199197 qdisc_put_rtab(R_tab);
net/sctp/socket.c+2−2
@@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), · 4621 unmodified lines
46224622
46234623 for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize;
46244624 hash++, head++) {
4625− read_lock(&head->lock);
4625+ read_lock_bh(&head->lock);
46264626 sctp_for_each_hentry(epb, &head->chain) {
46274627 err = cb(sctp_ep(epb), p);
46284628 if (err)
46294629 break;
46304630 }
4631− read_unlock(&head->lock);
4631+ read_unlock_bh(&head->lock);
46324632 }
46334633
46344634 return err;
net/tipc/msg.c+1−1
@@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) · 507 unmodified lines
508508 }
509509
510510 if (skb_cloned(_skb) &&
511− pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL))
511+ pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
512512 goto exit;
513513
514514 /* Now reverse the concerned fields */
net/unix/af_unix.c+6−1
@@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 998 unmodified lines
999999 struct path path = { };
10001000
10011001 err = -EINVAL;
1002− if (sunaddr->sun_family != AF_UNIX)
1002+ if (addr_len < offsetofend(struct sockaddr_un, sun_family) ||
1003+ sunaddr->sun_family != AF_UNIX)
10031004 goto out;
10041005
10051006 if (addr_len == sizeof(short)) {
@@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, · 104 unmodified lines
11101111 unsigned int hash;
11111112 int err;
11121113
1114+ err = -EINVAL;
1115+ if (alen < offsetofend(struct sockaddr, sa_family))
1116+ goto out;
1117+
11131118 if (addr->sa_family != AF_UNSPEC) {
11141119 err = unix_mkname(sunaddr, alen, &hash);
11151120 if (err < 0)
security/keys/Kconfig+5−1
@@ -20,6 +20,10 @@ config KEYS · 19 unmodified lines
2020
2121 If you are unsure as to whether this is required, answer N.
2222
23+config KEYS_COMPAT
24+ def_bool y
25+ depends on COMPAT && KEYS
26+
2327 config PERSISTENT_KEYRINGS
2428 bool "Enable register of persistent per-UID keyrings"
2529 depends on KEYS
@@ -89,9 +93,9 @@ config ENCRYPTED_KEYS · 63 unmodified lines
8993 config KEY_DH_OPERATIONS
9094 bool "Diffie-Hellman operations on retained keys"
9195 depends on KEYS
92− select MPILIB
9396 select CRYPTO
9497 select CRYPTO_HASH
98+ select CRYPTO_DH
9599 help
96100 This option provides support for calculating Diffie-Hellman
97101 public keys and shared secrets using values stored as keys
security/keys/dh.c+184−116
@@ -8,34 +8,17 @@ · 7 unmodified lines
88 * 2 of the License, or (at your option) any later version.
99 */
1010
11−#include <linux/mpi.h>
1211 #include <linux/slab.h>
1312 #include <linux/uaccess.h>
13+#include <linux/scatterlist.h>
1414 #include <linux/crypto.h>
1515 #include <crypto/hash.h>
16+#include <crypto/kpp.h>
17+#include <crypto/dh.h>
1618 #include <keys/user-type.h>
1719 #include "internal.h"
1820
19−/*
20− * Public key or shared secret generation function [RFC2631 sec 2.1.1]
21− *
22− * ya = g^xa mod p;
23− * or
24− * ZZ = yb^xa mod p;
25− *
26− * where xa is the local private key, ya is the local public key, g is
27− * the generator, p is the prime, yb is the remote public key, and ZZ
28− * is the shared secret.
29− *
30− * Both are the same calculation, so g or yb are the "base" and ya or
31− * ZZ are the "result".
32− */
33−static int do_dh(MPI result, MPI base, MPI xa, MPI p)
34−{
35− return mpi_powm(result, base, xa, p);
36−}
37−
38−static ssize_t mpi_from_key(key_serial_t keyid, size_t maxlen, MPI *mpi)
21+static ssize_t dh_data_from_key(key_serial_t keyid, void **data)
3922 {
4023 struct key *key;
4124 key_ref_t key_ref;
@@ -56,19 +39,17 @@ static ssize_t mpi_from_key(key_serial_t keyid, size_t maxlen, MPI *mpi) · 14 unmodified lines
5639 status = key_validate(key);
5740 if (status == 0) {
5841 const struct user_key_payload *payload;
42+ uint8_t *duplicate;
5943
6044 payload = user_key_payload_locked(key);
6145
62− if (maxlen == 0) {
63− *mpi = NULL;
46+ duplicate = kmemdup(payload->data, payload->datalen,
47+ GFP_KERNEL);
48+ if (duplicate) {
49+ *data = duplicate;
6450 ret = payload->datalen;
65− } else if (payload->datalen <= maxlen) {
66− *mpi = mpi_read_raw_data(payload->data,
67− payload->datalen);
68− if (*mpi)
69− ret = payload->datalen;
7051 } else {
71− ret = -EINVAL;
52+ ret = -ENOMEM;
7253 }
7354 }
7455 up_read(&key->sem);
@@ -79,6 +60,29 @@ error: · 4 unmodified lines
7960 return ret;
8061 }
8162
63+static void dh_free_data(struct dh *dh)
64+{
65+ kzfree(dh->key);
66+ kzfree(dh->p);
67+ kzfree(dh->g);
68+}
69+
70+struct dh_completion {
71+ struct completion completion;
72+ int err;
73+};
74+
75+static void dh_crypto_done(struct crypto_async_request *req, int err)
76+{
77+ struct dh_completion *compl = req->data;
78+
79+ if (err == -EINPROGRESS)
80+ return;
81+
82+ compl->err = err;
83+ complete(&compl->completion);
84+}
85+
8286 struct kdf_sdesc {
8387 struct shash_desc shash;
8488 char ctx[];
@@ -89,6 +93,7 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname) · 4 unmodified lines
8993 struct crypto_shash *tfm;
9094 struct kdf_sdesc *sdesc;
9195 int size;
96+ int err;
9297
9398 /* allocate synchronous hash */
9499 tfm = crypto_alloc_shash(hashname, 0, 0);
@@ -97,16 +102,25 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname) · 2 unmodified lines
97102 return PTR_ERR(tfm);
98103 }
99104
105+ err = -EINVAL;
106+ if (crypto_shash_digestsize(tfm) == 0)
107+ goto out_free_tfm;
108+
109+ err = -ENOMEM;
100110 size = sizeof(struct shash_desc) + crypto_shash_descsize(tfm);
101111 sdesc = kmalloc(size, GFP_KERNEL);
102112 if (!sdesc)
103− return -ENOMEM;
113+ goto out_free_tfm;
104114 sdesc->shash.tfm = tfm;
105115 sdesc->shash.flags = 0x0;
106116
107117 *sdesc_ret = sdesc;
108118
109119 return 0;
120+
121+out_free_tfm:
122+ crypto_free_shash(tfm);
123+ return err;
110124 }
111125
112126 static void kdf_dealloc(struct kdf_sdesc *sdesc)
@@ -120,14 +134,6 @@ static void kdf_dealloc(struct kdf_sdesc *sdesc) · 7 unmodified lines
120134 kzfree(sdesc);
121135 }
122136
123−/* convert 32 bit integer into its string representation */
124−static inline void crypto_kw_cpu_to_be32(u32 val, u8 *buf)
125−{
126− __be32 *a = (__be32 *)buf;
127−
128− *a = cpu_to_be32(val);
129−}
130−
131137 /*
132138 * Implementation of the KDF in counter mode according to SP800-108 section 5.1
133139 * as well as SP800-56A section 5.8.1 (Single-step KDF).
@@ -138,25 +144,39 @@ static inline void crypto_kw_cpu_to_be32(u32 val, u8 *buf) · 4 unmodified lines
138144 * 5.8.1.2).
139145 */
140146 static int kdf_ctr(struct kdf_sdesc *sdesc, const u8 *src, unsigned int slen,
141− u8 *dst, unsigned int dlen)
147+ u8 *dst, unsigned int dlen, unsigned int zlen)
142148 {
143149 struct shash_desc *desc = &sdesc->shash;
144150 unsigned int h = crypto_shash_digestsize(desc->tfm);
145151 int err = 0;
146152 u8 *dst_orig = dst;
147− u32 i = 1;
148− u8 iteration[sizeof(u32)];
153+ __be32 counter = cpu_to_be32(1);
149154
150155 while (dlen) {
151156 err = crypto_shash_init(desc);
152157 if (err)
153158 goto err;
154159
155− crypto_kw_cpu_to_be32(i, iteration);
156− err = crypto_shash_update(desc, iteration, sizeof(u32));
160+ err = crypto_shash_update(desc, (u8 *)&counter, sizeof(__be32));
157161 if (err)
158162 goto err;
159163
164+ if (zlen && h) {
165+ u8 tmpbuffer[h];
166+ size_t chunk = min_t(size_t, zlen, h);
167+ memset(tmpbuffer, 0, chunk);
168+
169+ do {
170+ err = crypto_shash_update(desc, tmpbuffer,
171+ chunk);
172+ if (err)
173+ goto err;
174+
175+ zlen -= chunk;
176+ chunk = min_t(size_t, zlen, h);
177+ } while (zlen);
178+ }
179+
160180 if (src && slen) {
161181 err = crypto_shash_update(desc, src, slen);
162182 if (err)
@@ -179,7 +199,7 @@ static int kdf_ctr(struct kdf_sdesc *sdesc, const u8 *src, unsigned int slen, · 16 unmodified lines
179199
180200 dlen -= h;
181201 dst += h;
182− i++;
202+ counter = cpu_to_be32(be32_to_cpu(counter) + 1);
183203 }
184204 }
185205
@@ -192,7 +212,7 @@ err: · 6 unmodified lines
192212
193213 static int keyctl_dh_compute_kdf(struct kdf_sdesc *sdesc,
194214 char __user *buffer, size_t buflen,
195− uint8_t *kbuf, size_t kbuflen)
215+ uint8_t *kbuf, size_t kbuflen, size_t lzero)
196216 {
197217 uint8_t *outbuf = NULL;
198218 int ret;
@@ -203,7 +223,7 @@ static int keyctl_dh_compute_kdf(struct kdf_sdesc *sdesc, · 4 unmodified lines
203223 goto err;
204224 }
205225
206− ret = kdf_ctr(sdesc, kbuf, kbuflen, outbuf, buflen);
226+ ret = kdf_ctr(sdesc, kbuf, kbuflen, outbuf, buflen, lzero);
207227 if (ret)
208228 goto err;
209229
@@ -221,21 +241,26 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params, · 11 unmodified lines
221241 struct keyctl_kdf_params *kdfcopy)
222242 {
223243 long ret;
224− MPI base, private, prime, result;
225− unsigned nbytes;
244+ ssize_t dlen;
245+ int secretlen;
246+ int outlen;
226247 struct keyctl_dh_params pcopy;
227− uint8_t *kbuf;
228− ssize_t keylen;
229− size_t resultlen;
248+ struct dh dh_inputs;
249+ struct scatterlist outsg;
250+ struct dh_completion compl;
251+ struct crypto_kpp *tfm;
252+ struct kpp_request *req;
253+ uint8_t *secret;
254+ uint8_t *outbuf;
230255 struct kdf_sdesc *sdesc = NULL;
231256
232257 if (!params || (!buffer && buflen)) {
233258 ret = -EINVAL;
234− goto out;
259+ goto out1;
235260 }
236261 if (copy_from_user(&pcopy, params, sizeof(pcopy)) != 0) {
237262 ret = -EFAULT;
238− goto out;
263+ goto out1;
239264 }
240265
241266 if (kdfcopy) {
@@ -244,104 +269,147 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params, · 2 unmodified lines
244269 if (buflen > KEYCTL_KDF_MAX_OUTPUT_LEN ||
245270 kdfcopy->otherinfolen > KEYCTL_KDF_MAX_OI_LEN) {
246271 ret = -EMSGSIZE;
247− goto out;
272+ goto out1;
248273 }
249274
250275 /* get KDF name string */
251276 hashname = strndup_user(kdfcopy->hashname, CRYPTO_MAX_ALG_NAME);
252277 if (IS_ERR(hashname)) {
253278 ret = PTR_ERR(hashname);
254− goto out;
279+ goto out1;
255280 }
256281
257282 /* allocate KDF from the kernel crypto API */
258283 ret = kdf_alloc(&sdesc, hashname);
259284 kfree(hashname);
260285 if (ret)
261− goto out;
286+ goto out1;
262287 }
263288
264− /*
265− * If the caller requests postprocessing with a KDF, allow an
266− * arbitrary output buffer size since the KDF ensures proper truncation.
267− */
268− keylen = mpi_from_key(pcopy.prime, kdfcopy ? SIZE_MAX : buflen, &prime);
269− if (keylen < 0 || !prime) {
270− /* buflen == 0 may be used to query the required buffer size,
271− * which is the prime key length.
272− */
273− ret = keylen;
274− goto out;
289+ memset(&dh_inputs, 0, sizeof(dh_inputs));
290+
291+ dlen = dh_data_from_key(pcopy.prime, &dh_inputs.p);
292+ if (dlen < 0) {
293+ ret = dlen;
294+ goto out1;
295+ }
296+ dh_inputs.p_size = dlen;
297+
298+ dlen = dh_data_from_key(pcopy.base, &dh_inputs.g);
299+ if (dlen < 0) {
300+ ret = dlen;
301+ goto out2;
275302 }
303+ dh_inputs.g_size = dlen;
276304
277− /* The result is never longer than the prime */
278− resultlen = keylen;
305+ dlen = dh_data_from_key(pcopy.private, &dh_inputs.key);
306+ if (dlen < 0) {
307+ ret = dlen;
308+ goto out2;
309+ }
310+ dh_inputs.key_size = dlen;
279311
280− keylen = mpi_from_key(pcopy.base, SIZE_MAX, &base);
281− if (keylen < 0 || !base) {
282− ret = keylen;
283− goto error1;
312+ secretlen = crypto_dh_key_len(&dh_inputs);
313+ secret = kmalloc(secretlen, GFP_KERNEL);
314+ if (!secret) {
315+ ret = -ENOMEM;
316+ goto out2;
284317 }
318+ ret = crypto_dh_encode_key(secret, secretlen, &dh_inputs);
319+ if (ret)
320+ goto out3;
285321
286− keylen = mpi_from_key(pcopy.private, SIZE_MAX, &private);
287− if (keylen < 0 || !private) {
288− ret = keylen;
289− goto error2;
322+ tfm = crypto_alloc_kpp("dh", CRYPTO_ALG_TYPE_KPP, 0);
323+ if (IS_ERR(tfm)) {
324+ ret = PTR_ERR(tfm);
325+ goto out3;
326+ }
327+
328+ ret = crypto_kpp_set_secret(tfm, secret, secretlen);
329+ if (ret)
330+ goto out4;
331+
332+ outlen = crypto_kpp_maxsize(tfm);
333+
334+ if (!kdfcopy) {
335+ /*
336+ * When not using a KDF, buflen 0 is used to read the
337+ * required buffer length
338+ */
339+ if (buflen == 0) {
340+ ret = outlen;
341+ goto out4;
342+ } else if (outlen > buflen) {
343+ ret = -EOVERFLOW;
344+ goto out4;
345+ }
290346 }
291347
292− result = mpi_alloc(0);
293− if (!result) {
348+ outbuf = kzalloc(kdfcopy ? (outlen + kdfcopy->otherinfolen) : outlen,
349+ GFP_KERNEL);
350+ if (!outbuf) {
294351 ret = -ENOMEM;
295− goto error3;
352+ goto out4;
296353 }
297354
298− /* allocate space for DH shared secret and SP800-56A otherinfo */
299− kbuf = kmalloc(kdfcopy ? (resultlen + kdfcopy->otherinfolen) : resultlen,
300− GFP_KERNEL);
301− if (!kbuf) {
355+ sg_init_one(&outsg, outbuf, outlen);
356+
357+ req = kpp_request_alloc(tfm, GFP_KERNEL);
358+ if (!req) {
302359 ret = -ENOMEM;
303− goto error4;
360+ goto out5;
304361 }
305362
363+ kpp_request_set_input(req, NULL, 0);
364+ kpp_request_set_output(req, &outsg, outlen);
365+ init_completion(&compl.completion);
366+ kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG |
367+ CRYPTO_TFM_REQ_MAY_SLEEP,
368+ dh_crypto_done, &compl);
369+
306370 /*
307− * Concatenate SP800-56A otherinfo past DH shared secret -- the
308− * input to the KDF is (DH shared secret || otherinfo)
371+ * For DH, generate_public_key and generate_shared_secret are
372+ * the same calculation
309373 */
310− if (kdfcopy && kdfcopy->otherinfo &&
311− copy_from_user(kbuf + resultlen, kdfcopy->otherinfo,
312− kdfcopy->otherinfolen) != 0) {
313− ret = -EFAULT;
314− goto error5;
374+ ret = crypto_kpp_generate_public_key(req);
375+ if (ret == -EINPROGRESS) {
376+ wait_for_completion(&compl.completion);
377+ ret = compl.err;
378+ if (ret)
379+ goto out6;
315380 }
316381
317− ret = do_dh(result, base, private, prime);
318− if (ret)
319− goto error5;
320−
321− ret = mpi_read_buffer(result, kbuf, resultlen, &nbytes, NULL);
322− if (ret != 0)
323− goto error5;
324−
325382 if (kdfcopy) {
326− ret = keyctl_dh_compute_kdf(sdesc, buffer, buflen, kbuf,
327− resultlen + kdfcopy->otherinfolen);
328− } else {
329− ret = nbytes;
330− if (copy_to_user(buffer, kbuf, nbytes) != 0)
383+ /*
384+ * Concatenate SP800-56A otherinfo past DH shared secret -- the
385+ * input to the KDF is (DH shared secret || otherinfo)
386+ */
387+ if (copy_from_user(outbuf + req->dst_len, kdfcopy->otherinfo,
388+ kdfcopy->otherinfolen) != 0) {
331389 ret = -EFAULT;
390+ goto out6;
391+ }
392+
393+ ret = keyctl_dh_compute_kdf(sdesc, buffer, buflen, outbuf,
394+ req->dst_len + kdfcopy->otherinfolen,
395+ outlen - req->dst_len);
396+ } else if (copy_to_user(buffer, outbuf, req->dst_len) == 0) {
397+ ret = req->dst_len;
398+ } else {
399+ ret = -EFAULT;
332400 }
333401
334−error5:
335− kzfree(kbuf);
336−error4:
337− mpi_free(result);
338−error3:
339− mpi_free(private);
340−error2:
341− mpi_free(base);
342−error1:
343− mpi_free(prime);
344−out:
402+out6:
403+ kpp_request_free(req);
404+out5:
405+ kzfree(outbuf);
406+out4:
407+ crypto_free_kpp(tfm);
408+out3:
409+ kzfree(secret);
410+out2:
411+ dh_free_data(&dh_inputs);
412+out1:
345413 kdf_dealloc(sdesc);
346414 return ret;
347415 }
security/keys/encrypted-keys/encrypted.c+74−130
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #include <linux/scatterlist.h>
3131 #include <linux/ctype.h>
3232 #include <crypto/aes.h>
33+#include <crypto/algapi.h>
3334 #include <crypto/hash.h>
3435 #include <crypto/sha.h>
3536 #include <crypto/skcipher.h>
@@ -54,13 +55,7 @@ static int blksize; · 18 unmodified lines
5455 #define MAX_DATA_SIZE 4096
5556 #define MIN_DATA_SIZE 20
5657
57−struct sdesc {
58− struct shash_desc shash;
59− char ctx[];
60−};
61−
62−static struct crypto_shash *hashalg;
63−static struct crypto_shash *hmacalg;
58+static struct crypto_shash *hash_tfm;
6459
6560 enum {
6661 Opt_err = -1, Opt_new, Opt_load, Opt_update
@@ -141,23 +136,22 @@ static int valid_ecryptfs_desc(const char *ecryptfs_desc) · 74 unmodified lines
141136 */
142137 static int valid_master_desc(const char *new_desc, const char *orig_desc)
143138 {
144− if (!memcmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) {
145− if (strlen(new_desc) == KEY_TRUSTED_PREFIX_LEN)
146− goto out;
147− if (orig_desc)
148− if (memcmp(new_desc, orig_desc, KEY_TRUSTED_PREFIX_LEN))
149− goto out;
150− } else if (!memcmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) {
151− if (strlen(new_desc) == KEY_USER_PREFIX_LEN)
152− goto out;
153− if (orig_desc)
154− if (memcmp(new_desc, orig_desc, KEY_USER_PREFIX_LEN))
155− goto out;
156− } else
157− goto out;
139+ int prefix_len;
140+
141+ if (!strncmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN))
142+ prefix_len = KEY_TRUSTED_PREFIX_LEN;
143+ else if (!strncmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN))
144+ prefix_len = KEY_USER_PREFIX_LEN;
145+ else
146+ return -EINVAL;
147+
148+ if (!new_desc[prefix_len])
149+ return -EINVAL;
150+
151+ if (orig_desc && strncmp(new_desc, orig_desc, prefix_len))
152+ return -EINVAL;
153+
158154 return 0;
159−out:
160− return -EINVAL;
161155 }
162156
163157 /*
@@ -321,53 +315,38 @@ error: · 157 unmodified lines
321315 return ukey;
322316 }
323317
324−static struct sdesc *alloc_sdesc(struct crypto_shash *alg)
325−{
326− struct sdesc *sdesc;
327− int size;
328−
329− size = sizeof(struct shash_desc) + crypto_shash_descsize(alg);
330− sdesc = kmalloc(size, GFP_KERNEL);
331− if (!sdesc)
332− return ERR_PTR(-ENOMEM);
333− sdesc->shash.tfm = alg;
334− sdesc->shash.flags = 0x0;
335− return sdesc;
336−}
337−
338−static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen,
318+static int calc_hash(struct crypto_shash *tfm, u8 *digest,
339319 const u8 *buf, unsigned int buflen)
340320 {
341− struct sdesc *sdesc;
342− int ret;
321+ SHASH_DESC_ON_STACK(desc, tfm);
322+ int err;
343323
344− sdesc = alloc_sdesc(hmacalg);
345− if (IS_ERR(sdesc)) {
346− pr_info("encrypted_key: can't alloc %s\n", hmac_alg);
347− return PTR_ERR(sdesc);
348− }
324+ desc->tfm = tfm;
325+ desc->flags = 0;
349326
350− ret = crypto_shash_setkey(hmacalg, key, keylen);
351− if (!ret)
352− ret = crypto_shash_digest(&sdesc->shash, buf, buflen, digest);
353− kfree(sdesc);
354− return ret;
327+ err = crypto_shash_digest(desc, buf, buflen, digest);
328+ shash_desc_zero(desc);
329+ return err;
355330 }
356331
357−static int calc_hash(u8 *digest, const u8 *buf, unsigned int buflen)
332+static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen,
333+ const u8 *buf, unsigned int buflen)
358334 {
359− struct sdesc *sdesc;
360− int ret;
335+ struct crypto_shash *tfm;
336+ int err;
361337
362− sdesc = alloc_sdesc(hashalg);
363− if (IS_ERR(sdesc)) {
364− pr_info("encrypted_key: can't alloc %s\n", hash_alg);
365− return PTR_ERR(sdesc);
338+ tfm = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC);
339+ if (IS_ERR(tfm)) {
340+ pr_err("encrypted_key: can't alloc %s transform: %ld\n",
341+ hmac_alg, PTR_ERR(tfm));
342+ return PTR_ERR(tfm);
366343 }
367344
368− ret = crypto_shash_digest(&sdesc->shash, buf, buflen, digest);
369− kfree(sdesc);
370− return ret;
345+ err = crypto_shash_setkey(tfm, key, keylen);
346+ if (!err)
347+ err = calc_hash(tfm, digest, buf, buflen);
348+ crypto_free_shash(tfm);
349+ return err;
371350 }
372351
373352 enum derived_key_type { ENC_KEY, AUTH_KEY };
@@ -385,10 +364,9 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, · 11 unmodified lines
385364 derived_buf_len = HASH_SIZE;
386365
387366 derived_buf = kzalloc(derived_buf_len, GFP_KERNEL);
388− if (!derived_buf) {
389− pr_err("encrypted_key: out of memory\n");
367+ if (!derived_buf)
390368 return -ENOMEM;
391− }
369+
392370 if (key_type)
393371 strcpy(derived_buf, "AUTH_KEY");
394372 else
@@ -396,8 +374,8 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, · 1 unmodified line
396374
397375 memcpy(derived_buf + strlen(derived_buf) + 1, master_key,
398376 master_keylen);
399− ret = calc_hash(derived_key, derived_buf, derived_buf_len);
400− kfree(derived_buf);
377+ ret = calc_hash(hash_tfm, derived_key, derived_buf, derived_buf_len);
378+ kzfree(derived_buf);
401379 return ret;
402380 }
403381
@@ -480,12 +458,9 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, · 76 unmodified lines
480458 struct skcipher_request *req;
481459 unsigned int encrypted_datalen;
482460 u8 iv[AES_BLOCK_SIZE];
483− unsigned int padlen;
484− char pad[16];
485461 int ret;
486462
487463 encrypted_datalen = roundup(epayload->decrypted_datalen, blksize);
488− padlen = encrypted_datalen - epayload->decrypted_datalen;
489464
490465 req = init_skcipher_req(derived_key, derived_keylen);
491466 ret = PTR_ERR(req);
@@ -493,11 +468,10 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, · 1 unmodified line
493468 goto out;
494469 dump_decrypted_data(epayload);
495470
496− memset(pad, 0, sizeof pad);
497471 sg_init_table(sg_in, 2);
498472 sg_set_buf(&sg_in[0], epayload->decrypted_data,
499473 epayload->decrypted_datalen);
500− sg_set_buf(&sg_in[1], pad, padlen);
474+ sg_set_page(&sg_in[1], ZERO_PAGE(0), AES_BLOCK_SIZE, 0);
501475
502476 sg_init_table(sg_out, 1);
503477 sg_set_buf(sg_out, epayload->encrypted_data, encrypted_datalen);
@@ -533,6 +507,7 @@ static int datablob_hmac_append(struct encrypted_key_payload *epayload, · 29 unmodified lines
533507 if (!ret)
534508 dump_hmac(NULL, digest, HASH_SIZE);
535509 out:
510+ memzero_explicit(derived_key, sizeof(derived_key));
536511 return ret;
537512 }
538513
@@ -561,8 +536,8 @@ static int datablob_hmac_verify(struct encrypted_key_payload *epayload, · 22 unmodified lines
561536 ret = calc_hmac(digest, derived_key, sizeof derived_key, p, len);
562537 if (ret < 0)
563538 goto out;
564− ret = memcmp(digest, epayload->format + epayload->datablob_len,
565− sizeof digest);
539+ ret = crypto_memneq(digest, epayload->format + epayload->datablob_len,
540+ sizeof(digest));
566541 if (ret) {
567542 ret = -EINVAL;
568543 dump_hmac("datablob",
@@ -571,6 +546,7 @@ static int datablob_hmac_verify(struct encrypted_key_payload *epayload, · 2 unmodified lines
571546 dump_hmac("calc", digest, HASH_SIZE);
572547 }
573548 out:
549+ memzero_explicit(derived_key, sizeof(derived_key));
574550 return ret;
575551 }
576552
@@ -584,9 +560,14 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 7 unmodified lines
584560 struct skcipher_request *req;
585561 unsigned int encrypted_datalen;
586562 u8 iv[AES_BLOCK_SIZE];
587− char pad[16];
563+ u8 *pad;
588564 int ret;
589565
566+ /* Throwaway buffer to hold the unused zero padding at the end */
567+ pad = kmalloc(AES_BLOCK_SIZE, GFP_KERNEL);
568+ if (!pad)
569+ return -ENOMEM;
570+
590571 encrypted_datalen = roundup(epayload->decrypted_datalen, blksize);
591572 req = init_skcipher_req(derived_key, derived_keylen);
592573 ret = PTR_ERR(req);
@@ -594,13 +575,12 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 1 unmodified line
594575 goto out;
595576 dump_encrypted_data(epayload, encrypted_datalen);
596577
597− memset(pad, 0, sizeof pad);
598578 sg_init_table(sg_in, 1);
599579 sg_init_table(sg_out, 2);
600580 sg_set_buf(sg_in, epayload->encrypted_data, encrypted_datalen);
601581 sg_set_buf(&sg_out[0], epayload->decrypted_data,
602582 epayload->decrypted_datalen);
603− sg_set_buf(&sg_out[1], pad, sizeof pad);
583+ sg_set_buf(&sg_out[1], pad, AES_BLOCK_SIZE);
604584
605585 memcpy(iv, epayload->iv, sizeof(iv));
606586 skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, iv);
@@ -612,6 +592,7 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 5 unmodified lines
612592 goto out;
613593 dump_decrypted_data(epayload);
614594 out:
595+ kfree(pad);
615596 return ret;
616597 }
617598
@@ -722,6 +703,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, · 104 unmodified lines
722703 out:
723704 up_read(&mkey->sem);
724705 key_put(mkey);
706+ memzero_explicit(derived_key, sizeof(derived_key));
725707 return ret;
726708 }
727709
@@ -828,13 +810,13 @@ static int encrypted_instantiate(struct key *key, · 100 unmodified lines
828810 ret = encrypted_init(epayload, key->description, format, master_desc,
829811 decrypted_datalen, hex_encoded_iv);
830812 if (ret < 0) {
831− kfree(epayload);
813+ kzfree(epayload);
832814 goto out;
833815 }
834816
835817 rcu_assign_keypointer(key, epayload);
836818 out:
837− kfree(datablob);
819+ kzfree(datablob);
838820 return ret;
839821 }
840822
@@ -843,8 +825,7 @@ static void encrypted_rcu_free(struct rcu_head *rcu) · 2 unmodified lines
843825 struct encrypted_key_payload *epayload;
844826
845827 epayload = container_of(rcu, struct encrypted_key_payload, rcu);
846− memset(epayload->decrypted_data, 0, epayload->decrypted_datalen);
847− kfree(epayload);
828+ kzfree(epayload);
848829 }
849830
850831 /*
@@ -902,7 +883,7 @@ static int encrypted_update(struct key *key, struct key_preparsed_payload *prep) · 51 unmodified lines
902883 rcu_assign_keypointer(key, new_epayload);
903884 call_rcu(&epayload->rcu, encrypted_rcu_free);
904885 out:
905− kfree(buf);
886+ kzfree(buf);
906887 return ret;
907888 }
908889
@@ -960,33 +941,26 @@ static long encrypted_read(const struct key *key, char __user *buffer, · 51 unmodified lines
960941
961942 up_read(&mkey->sem);
962943 key_put(mkey);
944+ memzero_explicit(derived_key, sizeof(derived_key));
963945
964946 if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0)
965947 ret = -EFAULT;
966− kfree(ascii_buf);
948+ kzfree(ascii_buf);
967949
968950 return asciiblob_len;
969951 out:
970952 up_read(&mkey->sem);
971953 key_put(mkey);
954+ memzero_explicit(derived_key, sizeof(derived_key));
972955 return ret;
973956 }
974957
975958 /*
976− * encrypted_destroy - before freeing the key, clear the decrypted data
977− *
978− * Before freeing the key, clear the memory containing the decrypted
979− * key data.
959+ * encrypted_destroy - clear and free the key's payload
980960 */
981961 static void encrypted_destroy(struct key *key)
982962 {
983− struct encrypted_key_payload *epayload = key->payload.data[0];
984−
985− if (!epayload)
986− return;
987−
988− memzero_explicit(epayload->decrypted_data, epayload->decrypted_datalen);
989− kfree(key->payload.data[0]);
963+ kzfree(key->payload.data[0]);
990964 }
991965
992966 struct key_type key_type_encrypted = {
@@ -999,47 +973,17 @@ struct key_type key_type_encrypted = { · 6 unmodified lines
999973 };
1000974 EXPORT_SYMBOL_GPL(key_type_encrypted);
1001975
1002−static void encrypted_shash_release(void)
1003−{
1004− if (hashalg)
1005− crypto_free_shash(hashalg);
1006− if (hmacalg)
1007− crypto_free_shash(hmacalg);
1008−}
1009−
1010−static int __init encrypted_shash_alloc(void)
976+static int __init init_encrypted(void)
1011977 {
1012978 int ret;
1013979
1014− hmacalg = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC);
1015− if (IS_ERR(hmacalg)) {
1016− pr_info("encrypted_key: could not allocate crypto %s\n",
1017− hmac_alg);
1018− return PTR_ERR(hmacalg);
1019− }
1020−
1021− hashalg = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
1022− if (IS_ERR(hashalg)) {
1023− pr_info("encrypted_key: could not allocate crypto %s\n",
1024− hash_alg);
1025− ret = PTR_ERR(hashalg);
1026− goto hashalg_fail;
980+ hash_tfm = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
981+ if (IS_ERR(hash_tfm)) {
982+ pr_err("encrypted_key: can't allocate %s transform: %ld\n",
983+ hash_alg, PTR_ERR(hash_tfm));
984+ return PTR_ERR(hash_tfm);
1027985 }
1028986
1029− return 0;
1030−
1031−hashalg_fail:
1032− crypto_free_shash(hmacalg);
1033− return ret;
1034−}
1035−
1036−static int __init init_encrypted(void)
1037−{
1038− int ret;
1039−
1040− ret = encrypted_shash_alloc();
1041− if (ret < 0)
1042− return ret;
1043987 ret = aes_get_sizes();
1044988 if (ret < 0)
1045989 goto out;
@@ -1048,14 +992,14 @@ static int __init init_encrypted(void) · 2 unmodified lines
1048992 goto out;
1049993 return 0;
1050994 out:
1051− encrypted_shash_release();
995+ crypto_free_shash(hash_tfm);
1052996 return ret;
1053997
1054998 }
1055999
10561000 static void __exit cleanup_encrypted(void)
10571001 {
1058− encrypted_shash_release();
1002+ crypto_free_shash(hash_tfm);
10591003 unregister_key_type(&key_type_encrypted);
10601004 }
10611005
security/keys/gc.c+1−3
@@ -158,9 +158,7 @@ static noinline void key_gc_unused_keys(struct list_head *keys) · 157 unmodified lines
158158
159159 kfree(key->description);
160160
161−#ifdef KEY_DEBUGGING
162− key->magic = KEY_DEBUG_MAGIC_X;
163−#endif
161+ memzero_explicit(key, sizeof(*key));
164162 kmem_cache_free(key_jar, key);
165163 }
166164 }
security/keys/key.c+6−10
@@ -660,14 +660,11 @@ not_found: · 659 unmodified lines
660660 goto error;
661661
662662 found:
663− /* pretend it doesn't exist if it is awaiting deletion */
664− if (refcount_read(&key->usage) == 0)
665− goto not_found;
666−
667− /* this races with key_put(), but that doesn't matter since key_put()
668− * doesn't actually change the key
663+ /* A key is allowed to be looked up only if someone still owns a
664+ * reference to it - otherwise it's awaiting the gc.
669665 */
670− __key_get(key);
666+ if (!refcount_inc_not_zero(&key->usage))
667+ goto not_found;
671668
672669 error:
673670 spin_unlock(&key_serial_lock);
@@ -966,12 +963,11 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen) · 292 unmodified lines
966963 /* the key must be writable */
967964 ret = key_permission(key_ref, KEY_NEED_WRITE);
968965 if (ret < 0)
969− goto error;
966+ return ret;
970967
971968 /* attempt to update it if supported */
972− ret = -EOPNOTSUPP;
973969 if (!key->type->update)
974− goto error;
970+ return -EOPNOTSUPP;
975971
976972 memset(&prep, 0, sizeof(prep));
977973 prep.data = payload;
security/keys/keyctl.c+11−5
@@ -99,7 +99,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, · 98 unmodified lines
9999 /* pull the payload in if one was supplied */
100100 payload = NULL;
101101
102− if (_payload) {
102+ if (plen) {
103103 ret = -ENOMEM;
104104 payload = kvmalloc(plen, GFP_KERNEL);
105105 if (!payload)
@@ -132,7 +132,10 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, · 26 unmodified lines
132132
133133 key_ref_put(keyring_ref);
134134 error3:
135− kvfree(payload);
135+ if (payload) {
136+ memzero_explicit(payload, plen);
137+ kvfree(payload);
138+ }
136139 error2:
137140 kfree(description);
138141 error:
@@ -324,7 +327,7 @@ long keyctl_update_key(key_serial_t id, · 185 unmodified lines
324327
325328 /* pull the payload in if one was supplied */
326329 payload = NULL;
327− if (_payload) {
330+ if (plen) {
328331 ret = -ENOMEM;
329332 payload = kmalloc(plen, GFP_KERNEL);
330333 if (!payload)
@@ -347,7 +350,7 @@ long keyctl_update_key(key_serial_t id, · 16 unmodified lines
347350
348351 key_ref_put(key_ref);
349352 error2:
350− kfree(payload);
353+ kzfree(payload);
351354 error:
352355 return ret;
353356 }
@@ -1093,7 +1096,10 @@ long keyctl_instantiate_key_common(key_serial_t id, · 739 unmodified lines
10931096 keyctl_change_reqkey_auth(NULL);
10941097
10951098 error2:
1096− kvfree(payload);
1099+ if (payload) {
1100+ memzero_explicit(payload, plen);
1101+ kvfree(payload);
1102+ }
10971103 error:
10981104 return ret;
10991105 }
security/keys/keyring.c+6−6
@@ -706,7 +706,7 @@ descend_to_keyring: · 705 unmodified lines
706706 * Non-keyrings avoid the leftmost branch of the root entirely (root
707707 * slots 1-15).
708708 */
709− ptr = ACCESS_ONCE(keyring->keys.root);
709+ ptr = READ_ONCE(keyring->keys.root);
710710 if (!ptr)
711711 goto not_this_keyring;
712712
@@ -720,7 +720,7 @@ descend_to_keyring: · 7 unmodified lines
720720 if ((shortcut->index_key[0] & ASSOC_ARRAY_FAN_MASK) != 0)
721721 goto not_this_keyring;
722722
723− ptr = ACCESS_ONCE(shortcut->next_node);
723+ ptr = READ_ONCE(shortcut->next_node);
724724 node = assoc_array_ptr_to_node(ptr);
725725 goto begin_node;
726726 }
@@ -740,7 +740,7 @@ descend_to_node: · 13 unmodified lines
740740 if (assoc_array_ptr_is_shortcut(ptr)) {
741741 shortcut = assoc_array_ptr_to_shortcut(ptr);
742742 smp_read_barrier_depends();
743− ptr = ACCESS_ONCE(shortcut->next_node);
743+ ptr = READ_ONCE(shortcut->next_node);
744744 BUG_ON(!assoc_array_ptr_is_node(ptr));
745745 }
746746 node = assoc_array_ptr_to_node(ptr);
@@ -752,7 +752,7 @@ begin_node: · 5 unmodified lines
752752 ascend_to_node:
753753 /* Go through the slots in a node */
754754 for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) {
755− ptr = ACCESS_ONCE(node->slots[slot]);
755+ ptr = READ_ONCE(node->slots[slot]);
756756
757757 if (assoc_array_ptr_is_meta(ptr) && node->back_pointer)
758758 goto descend_to_node;
@@ -790,13 +790,13 @@ ascend_to_node: · 31 unmodified lines
790790 /* We've dealt with all the slots in the current node, so now we need
791791 * to ascend to the parent and continue processing there.
792792 */
793− ptr = ACCESS_ONCE(node->back_pointer);
793+ ptr = READ_ONCE(node->back_pointer);
794794 slot = node->parent_slot;
795795
796796 if (ptr && assoc_array_ptr_is_shortcut(ptr)) {
797797 shortcut = assoc_array_ptr_to_shortcut(ptr);
798798 smp_read_barrier_depends();
799− ptr = ACCESS_ONCE(shortcut->back_pointer);
799+ ptr = READ_ONCE(shortcut->back_pointer);
800800 slot = shortcut->parent_slot;
801801 }
802802 if (!ptr)
security/keys/process_keys.c+4−3
@@ -809,15 +809,14 @@ long join_session_keyring(const char *name) · 808 unmodified lines
809809 ret = PTR_ERR(keyring);
810810 goto error2;
811811 } else if (keyring == new->session_keyring) {
812− key_put(keyring);
813812 ret = 0;
814− goto error2;
813+ goto error3;
815814 }
816815
817816 /* we've got a keyring - now to install it */
818817 ret = install_session_keyring_to_cred(new, keyring);
819818 if (ret < 0)
820− goto error2;
819+ goto error3;
821820
822821 commit_creds(new);
823822 mutex_unlock(&key_session_mutex);
@@ -827,6 +826,8 @@ long join_session_keyring(const char *name) · 3 unmodified lines
827826 okay:
828827 return ret;
829828
829+error3:
830+ key_put(keyring);
830831 error2:
831832 mutex_unlock(&key_session_mutex);
832833 error:
security/keys/trusted.c+22−28
@@ -70,7 +70,7 @@ static int TSS_sha1(const unsigned char *data, unsigned int datalen, · 69 unmodified lines
7070 }
7171
7272 ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest);
73− kfree(sdesc);
73+ kzfree(sdesc);
7474 return ret;
7575 }
7676
@@ -114,7 +114,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key, · 37 unmodified lines
114114 if (!ret)
115115 ret = crypto_shash_final(&sdesc->shash, digest);
116116 out:
117− kfree(sdesc);
117+ kzfree(sdesc);
118118 return ret;
119119 }
120120
@@ -165,7 +165,7 @@ static int TSS_authhmac(unsigned char *digest, const unsigned char *key, · 44 unmodified lines
165165 paramdigest, TPM_NONCE_SIZE, h1,
166166 TPM_NONCE_SIZE, h2, 1, &c, 0, 0);
167167 out:
168− kfree(sdesc);
168+ kzfree(sdesc);
169169 return ret;
170170 }
171171
@@ -246,7 +246,7 @@ static int TSS_checkhmac1(unsigned char *buffer, · 74 unmodified lines
246246 if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE))
247247 ret = -EINVAL;
248248 out:
249− kfree(sdesc);
249+ kzfree(sdesc);
250250 return ret;
251251 }
252252
@@ -347,7 +347,7 @@ static int TSS_checkhmac2(unsigned char *buffer, · 94 unmodified lines
347347 if (memcmp(testhmac2, authdata2, SHA1_DIGEST_SIZE))
348348 ret = -EINVAL;
349349 out:
350− kfree(sdesc);
350+ kzfree(sdesc);
351351 return ret;
352352 }
353353
@@ -564,7 +564,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype, · 210 unmodified lines
564564 *bloblen = storedsize;
565565 }
566566 out:
567− kfree(td);
567+ kzfree(td);
568568 return ret;
569569 }
570570
@@ -678,7 +678,7 @@ static int key_seal(struct trusted_key_payload *p, · 107 unmodified lines
678678 if (ret < 0)
679679 pr_info("trusted_key: srkseal failed (%d)\n", ret);
680680
681− kfree(tb);
681+ kzfree(tb);
682682 return ret;
683683 }
684684
@@ -703,7 +703,7 @@ static int key_unseal(struct trusted_key_payload *p, · 18 unmodified lines
703703 /* pull migratable flag out of sealed key */
704704 p->migratable = p->key[--p->key_len];
705705
706− kfree(tb);
706+ kzfree(tb);
707707 return ret;
708708 }
709709
@@ -1037,12 +1037,12 @@ static int trusted_instantiate(struct key *key, · 327 unmodified lines
10371037 if (!ret && options->pcrlock)
10381038 ret = pcrlock(options->pcrlock);
10391039 out:
1040− kfree(datablob);
1041− kfree(options);
1040+ kzfree(datablob);
1041+ kzfree(options);
10421042 if (!ret)
10431043 rcu_assign_keypointer(key, payload);
10441044 else
1045− kfree(payload);
1045+ kzfree(payload);
10461046 return ret;
10471047 }
10481048
@@ -1051,8 +1051,7 @@ static void trusted_rcu_free(struct rcu_head *rcu) · 2 unmodified lines
10511051 struct trusted_key_payload *p;
10521052
10531053 p = container_of(rcu, struct trusted_key_payload, rcu);
1054− memset(p->key, 0, p->key_len);
1055− kfree(p);
1054+ kzfree(p);
10561055 }
10571056
10581057 /*
@@ -1094,13 +1093,13 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep) · 35 unmodified lines
10941093 ret = datablob_parse(datablob, new_p, new_o);
10951094 if (ret != Opt_update) {
10961095 ret = -EINVAL;
1097− kfree(new_p);
1096+ kzfree(new_p);
10981097 goto out;
10991098 }
11001099
11011100 if (!new_o->keyhandle) {
11021101 ret = -EINVAL;
1103− kfree(new_p);
1102+ kzfree(new_p);
11041103 goto out;
11051104 }
11061105
@@ -1114,22 +1113,22 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep) · 7 unmodified lines
11141113 ret = key_seal(new_p, new_o);
11151114 if (ret < 0) {
11161115 pr_info("trusted_key: key_seal failed (%d)\n", ret);
1117− kfree(new_p);
1116+ kzfree(new_p);
11181117 goto out;
11191118 }
11201119 if (new_o->pcrlock) {
11211120 ret = pcrlock(new_o->pcrlock);
11221121 if (ret < 0) {
11231122 pr_info("trusted_key: pcrlock failed (%d)\n", ret);
1124− kfree(new_p);
1123+ kzfree(new_p);
11251124 goto out;
11261125 }
11271126 }
11281127 rcu_assign_keypointer(key, new_p);
11291128 call_rcu(&p->rcu, trusted_rcu_free);
11301129 out:
1131− kfree(datablob);
1132− kfree(new_o);
1130+ kzfree(datablob);
1131+ kzfree(new_o);
11331132 return ret;
11341133 }
11351134
@@ -1158,24 +1157,19 @@ static long trusted_read(const struct key *key, char __user *buffer, · 22 unmodified lines
11581157 for (i = 0; i < p->blob_len; i++)
11591158 bufp = hex_byte_pack(bufp, p->blob[i]);
11601159 if ((copy_to_user(buffer, ascii_buf, 2 * p->blob_len)) != 0) {
1161− kfree(ascii_buf);
1160+ kzfree(ascii_buf);
11621161 return -EFAULT;
11631162 }
1164− kfree(ascii_buf);
1163+ kzfree(ascii_buf);
11651164 return 2 * p->blob_len;
11661165 }
11671166
11681167 /*
1169− * trusted_destroy - before freeing the key, clear the decrypted data
1168+ * trusted_destroy - clear and free the key's payload
11701169 */
11711170 static void trusted_destroy(struct key *key)
11721171 {
1173− struct trusted_key_payload *p = key->payload.data[0];
1174−
1175− if (!p)
1176− return;
1177− memset(p->key, 0, p->key_len);
1178− kfree(key->payload.data[0]);
1172+ kzfree(key->payload.data[0]);
11791173 }
11801174
11811175 struct key_type key_type_trusted = {
security/keys/user_defined.c+12−4
@@ -86,10 +86,18 @@ EXPORT_SYMBOL_GPL(user_preparse); · 85 unmodified lines
8686 */
8787 void user_free_preparse(struct key_preparsed_payload *prep)
8888 {
89− kfree(prep->payload.data[0]);
89+ kzfree(prep->payload.data[0]);
9090 }
9191 EXPORT_SYMBOL_GPL(user_free_preparse);
9292
93+static void user_free_payload_rcu(struct rcu_head *head)
94+{
95+ struct user_key_payload *payload;
96+
97+ payload = container_of(head, struct user_key_payload, rcu);
98+ kzfree(payload);
99+}
100+
93101 /*
94102 * update a user defined key
95103 * - the key's semaphore is write-locked
@@ -112,7 +120,7 @@ int user_update(struct key *key, struct key_preparsed_payload *prep) · 16 unmodified lines
112120 prep->payload.data[0] = NULL;
113121
114122 if (zap)
115− kfree_rcu(zap, rcu);
123+ call_rcu(&zap->rcu, user_free_payload_rcu);
116124 return ret;
117125 }
118126 EXPORT_SYMBOL_GPL(user_update);
@@ -130,7 +138,7 @@ void user_revoke(struct key *key) · 11 unmodified lines
130138
131139 if (upayload) {
132140 rcu_assign_keypointer(key, NULL);
133− kfree_rcu(upayload, rcu);
141+ call_rcu(&upayload->rcu, user_free_payload_rcu);
134142 }
135143 }
136144
@@ -143,7 +151,7 @@ void user_destroy(struct key *key) · 6 unmodified lines
143151 {
144152 struct user_key_payload *upayload = key->payload.data[0];
145153
146− kfree(upayload);
154+ kzfree(upayload);
147155 }
148156
149157 EXPORT_SYMBOL_GPL(user_destroy);
sound/core/timer.c+5−2
@@ -1618,6 +1618,7 @@ static int snd_timer_user_tselect(struct file *file, · 1617 unmodified lines
16181618 if (err < 0)
16191619 goto __err;
16201620
1621+ tu->qhead = tu->qtail = tu->qused = 0;
16211622 kfree(tu->queue);
16221623 tu->queue = NULL;
16231624 kfree(tu->tqueue);
@@ -1959,6 +1960,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 335 unmodified lines
19591960
19601961 tu = file->private_data;
19611962 unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read);
1963+ mutex_lock(&tu->ioctl_lock);
19621964 spin_lock_irq(&tu->qlock);
19631965 while ((long)count - result >= unit) {
19641966 while (!tu->qused) {
@@ -1974,7 +1976,9 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 9 unmodified lines
19741976 add_wait_queue(&tu->qchange_sleep, &wait);
19751977
19761978 spin_unlock_irq(&tu->qlock);
1979+ mutex_unlock(&tu->ioctl_lock);
19771980 schedule();
1981+ mutex_lock(&tu->ioctl_lock);
19781982 spin_lock_irq(&tu->qlock);
19791983
19801984 remove_wait_queue(&tu->qchange_sleep, &wait);
@@ -1994,7 +1998,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 13 unmodified lines
19941998 tu->qused--;
19951999 spin_unlock_irq(&tu->qlock);
19962000
1997− mutex_lock(&tu->ioctl_lock);
19982001 if (tu->tread) {
19992002 if (copy_to_user(buffer, &tu->tqueue[qhead],
20002003 sizeof(struct snd_timer_tread)))
@@ -2004,7 +2007,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 3 unmodified lines
20042007 sizeof(struct snd_timer_read)))
20052008 err = -EFAULT;
20062009 }
2007− mutex_unlock(&tu->ioctl_lock);
20082010
20092011 spin_lock_irq(&tu->qlock);
20102012 if (err < 0)
@@ -2014,6 +2016,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 3 unmodified lines
20142016 }
20152017 _error:
20162018 spin_unlock_irq(&tu->qlock);
2019+ mutex_unlock(&tu->ioctl_lock);
20172020 return result > 0 ? result : err;
20182021 }
20192022
sound/pci/hda/patch_realtek.c+6−5
@@ -5854,7 +5854,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5853 unmodified lines
58545854 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
58555855 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
58565856 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
5857+ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
58575858 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5859+ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5860+ SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
5861+ SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
58585862 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
58595863 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
58605864 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
@@ -5862,13 +5866,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 1 unmodified line
58625866 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
58635867 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
58645868 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5869+ SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
58655870 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5866− SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
58675871 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5868− SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5869− SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5870− SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
5871− SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
5872+ SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
58725873 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
58735874 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
58745875 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
sound/soc/atmel/atmel-classd.c+9−0
@@ -301,6 +301,14 @@ static int atmel_classd_codec_probe(struct snd_soc_codec *codec) · 300 unmodified lines
301301 return 0;
302302 }
303303
304+static int atmel_classd_codec_resume(struct snd_soc_codec *codec)
305+{
306+ struct snd_soc_card *card = snd_soc_codec_get_drvdata(codec);
307+ struct atmel_classd *dd = snd_soc_card_get_drvdata(card);
308+
309+ return regcache_sync(dd->regmap);
310+}
311+
304312 static struct regmap *atmel_classd_codec_get_remap(struct device *dev)
305313 {
306314 return dev_get_regmap(dev, NULL);
@@ -308,6 +316,7 @@ static struct regmap *atmel_classd_codec_get_remap(struct device *dev) · 1 unmodified line
308316
309317 static struct snd_soc_codec_driver soc_codec_dev_classd = {
310318 .probe = atmel_classd_codec_probe,
319+ .resume = atmel_classd_codec_resume,
311320 .get_regmap = atmel_classd_codec_get_remap,
312321 .component_driver = {
313322 .controls = atmel_classd_snd_controls,
sound/soc/codecs/da7213.c+1−1
@@ -772,7 +772,7 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, · 771 unmodified lines
772772 ++i;
773773 msleep(50);
774774 }
775− } while ((i < DA7213_SRM_CHECK_RETRIES) & (!srm_lock));
775+ } while ((i < DA7213_SRM_CHECK_RETRIES) && (!srm_lock));
776776
777777 if (!srm_lock)
778778 dev_warn(codec->dev, "SRM failed to lock\n");
sound/soc/codecs/rt286.c+7−0
@@ -1108,6 +1108,13 @@ static const struct dmi_system_id force_combo_jack_table[] = { · 1107 unmodified lines
11081108 DMI_MATCH(DMI_PRODUCT_NAME, "Kabylake Client platform")
11091109 }
11101110 },
1111+ {
1112+ .ident = "Thinkpad Helix 2nd",
1113+ .matches = {
1114+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1115+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix 2nd")
1116+ }
1117+ },
11111118
11121119 { }
11131120 };
sound/soc/generic/simple-card.c+1−1
@@ -202,7 +202,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) · 201 unmodified lines
202202 if (ret < 0)
203203 return ret;
204204
205− ret = asoc_simple_card_init_mic(rtd->card, &priv->hp_jack, PREFIX);
205+ ret = asoc_simple_card_init_mic(rtd->card, &priv->mic_jack, PREFIX);
206206 if (ret < 0)
207207 return ret;
208208
sound/soc/intel/skylake/skl-sst-ipc.c+5−0
@@ -413,8 +413,11 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, · 412 unmodified lines
413413 u32 reply = header.primary & IPC_GLB_REPLY_STATUS_MASK;
414414 u64 *ipc_header = (u64 *)(&header);
415415 struct skl_sst *skl = container_of(ipc, struct skl_sst, ipc);
416+ unsigned long flags;
416417
418+ spin_lock_irqsave(&ipc->dsp->spinlock, flags);
417419 msg = skl_ipc_reply_get_msg(ipc, *ipc_header);
420+ spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
418421 if (msg == NULL) {
419422 dev_dbg(ipc->dev, "ipc: rx list is empty\n");
420423 return;
@@ -456,8 +459,10 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, · 35 unmodified lines
456459 }
457460 }
458461
462+ spin_lock_irqsave(&ipc->dsp->spinlock, flags);
459463 list_del(&msg->list);
460464 sst_ipc_tx_msg_reply_complete(ipc, msg);
465+ spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
461466 }
462467
463468 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
sound/soc/intel/skylake/skl-topology.c+1−1
@@ -2502,7 +2502,7 @@ static int skl_tplg_get_manifest_tkn(struct device *dev, · 2501 unmodified lines
25022502
25032503 if (ret < 0)
25042504 return ret;
2505− tkn_count += ret;
2505+ tkn_count = ret;
25062506
25072507 tuple_size += tkn_count *
25082508 sizeof(struct snd_soc_tplg_vendor_string_elem);
sound/soc/intel/skylake/skl.c+88−74
@@ -410,7 +410,7 @@ static int skl_free(struct hdac_ext_bus *ebus) · 409 unmodified lines
410410 struct skl *skl = ebus_to_skl(ebus);
411411 struct hdac_bus *bus = ebus_to_hbus(ebus);
412412
413− skl->init_failed = 1; /* to be sure */
413+ skl->init_done = 0; /* to be sure */
414414
415415 snd_hdac_ext_stop_streams(ebus);
416416
@@ -428,8 +428,10 @@ static int skl_free(struct hdac_ext_bus *ebus) · 11 unmodified lines
428428
429429 snd_hdac_ext_bus_exit(ebus);
430430
431+ cancel_work_sync(&skl->probe_work);
431432 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
432433 snd_hdac_i915_exit(&ebus->bus);
434+
433435 return 0;
434436 }
435437
@@ -566,6 +568,84 @@ static const struct hdac_bus_ops bus_core_ops = { · 130 unmodified lines
566568 .get_response = snd_hdac_bus_get_response,
567569 };
568570
571+static int skl_i915_init(struct hdac_bus *bus)
572+{
573+ int err;
574+
575+ /*
576+ * The HDMI codec is in GPU so we need to ensure that it is powered
577+ * up and ready for probe
578+ */
579+ err = snd_hdac_i915_init(bus);
580+ if (err < 0)
581+ return err;
582+
583+ err = snd_hdac_display_power(bus, true);
584+ if (err < 0)
585+ dev_err(bus->dev, "Cannot turn on display power on i915\n");
586+
587+ return err;
588+}
589+
590+static void skl_probe_work(struct work_struct *work)
591+{
592+ struct skl *skl = container_of(work, struct skl, probe_work);
593+ struct hdac_ext_bus *ebus = &skl->ebus;
594+ struct hdac_bus *bus = ebus_to_hbus(ebus);
595+ struct hdac_ext_link *hlink = NULL;
596+ int err;
597+
598+ if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
599+ err = skl_i915_init(bus);
600+ if (err < 0)
601+ return;
602+ }
603+
604+ err = skl_init_chip(bus, true);
605+ if (err < 0) {
606+ dev_err(bus->dev, "Init chip failed with err: %d\n", err);
607+ goto out_err;
608+ }
609+
610+ /* codec detection */
611+ if (!bus->codec_mask)
612+ dev_info(bus->dev, "no hda codecs found!\n");
613+
614+ /* create codec instances */
615+ err = skl_codec_create(ebus);
616+ if (err < 0)
617+ goto out_err;
618+
619+ if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
620+ err = snd_hdac_display_power(bus, false);
621+ if (err < 0) {
622+ dev_err(bus->dev, "Cannot turn off display power on i915\n");
623+ return;
624+ }
625+ }
626+
627+ /* register platform dai and controls */
628+ err = skl_platform_register(bus->dev);
629+ if (err < 0)
630+ return;
631+ /*
632+ * we are done probing so decrement link counts
633+ */
634+ list_for_each_entry(hlink, &ebus->hlink_list, list)
635+ snd_hdac_ext_bus_link_put(ebus, hlink);
636+
637+ /* configure PM */
638+ pm_runtime_put_noidle(bus->dev);
639+ pm_runtime_allow(bus->dev);
640+ skl->init_done = 1;
641+
642+ return;
643+
644+out_err:
645+ if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
646+ err = snd_hdac_display_power(bus, false);
647+}
648+
569649 /*
570650 * constructor
571651 */
@@ -593,6 +673,7 @@ static int skl_create(struct pci_dev *pci, · 21 unmodified lines
593673 snd_hdac_ext_bus_init(ebus, &pci->dev, &bus_core_ops, io_ops);
594674 ebus->bus.use_posbuf = 1;
595675 skl->pci = pci;
676+ INIT_WORK(&skl->probe_work, skl_probe_work);
596677
597678 ebus->bus.bdl_pos_adj = 0;
598679
@@ -601,27 +682,6 @@ static int skl_create(struct pci_dev *pci, · 2 unmodified lines
601682 return 0;
602683 }
603684
604−static int skl_i915_init(struct hdac_bus *bus)
605−{
606− int err;
607−
608− /*
609− * The HDMI codec is in GPU so we need to ensure that it is powered
610− * up and ready for probe
611− */
612− err = snd_hdac_i915_init(bus);
613− if (err < 0)
614− return err;
615−
616− err = snd_hdac_display_power(bus, true);
617− if (err < 0) {
618− dev_err(bus->dev, "Cannot turn on display power on i915\n");
619− return err;
620− }
621−
622− return err;
623−}
624−
625685 static int skl_first_init(struct hdac_ext_bus *ebus)
626686 {
627687 struct skl *skl = ebus_to_skl(ebus);
@@ -684,20 +744,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus) · 56 unmodified lines
684744 /* initialize chip */
685745 skl_init_pci(skl);
686746
687− if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
688− err = skl_i915_init(bus);
689− if (err < 0)
690− return err;
691− }
692−
693− skl_init_chip(bus, true);
694−
695− /* codec detection */
696− if (!bus->codec_mask) {
697− dev_info(bus->dev, "no hda codecs found!\n");
698− }
699−
700− return 0;
747+ return skl_init_chip(bus, true);
701748 }
702749
703750 static int skl_probe(struct pci_dev *pci,
@@ -706,7 +753,6 @@ static int skl_probe(struct pci_dev *pci, · 2 unmodified lines
706753 struct skl *skl;
707754 struct hdac_ext_bus *ebus = NULL;
708755 struct hdac_bus *bus = NULL;
709− struct hdac_ext_link *hlink = NULL;
710756 int err;
711757
712758 /* we use ext core ops, so provide NULL for ops here */
@@ -729,7 +775,7 @@ static int skl_probe(struct pci_dev *pci, · 16 unmodified lines
729775
730776 if (skl->nhlt == NULL) {
731777 err = -ENODEV;
732− goto out_display_power_off;
778+ goto out_free;
733779 }
734780
735781 err = skl_nhlt_create_sysfs(skl);
@@ -760,56 +806,24 @@ static int skl_probe(struct pci_dev *pci, · 24 unmodified lines
760806 if (bus->mlcap)
761807 snd_hdac_ext_bus_get_ml_capabilities(ebus);
762808
809+ snd_hdac_bus_stop_chip(bus);
810+
763811 /* create device for soc dmic */
764812 err = skl_dmic_device_register(skl);
765813 if (err < 0)
766814 goto out_dsp_free;
767815
768− /* register platform dai and controls */
769− err = skl_platform_register(bus->dev);
770− if (err < 0)
771− goto out_dmic_free;
772−
773− /* create codec instances */
774− err = skl_codec_create(ebus);
775− if (err < 0)
776− goto out_unregister;
777−
778− if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
779− err = snd_hdac_display_power(bus, false);
780− if (err < 0) {
781− dev_err(bus->dev, "Cannot turn off display power on i915\n");
782− return err;
783− }
784− }
785−
786− /*
787− * we are done probling so decrement link counts
788− */
789− list_for_each_entry(hlink, &ebus->hlink_list, list)
790− snd_hdac_ext_bus_link_put(ebus, hlink);
791−
792− /* configure PM */
793− pm_runtime_put_noidle(bus->dev);
794− pm_runtime_allow(bus->dev);
816+ schedule_work(&skl->probe_work);
795817
796818 return 0;
797819
798−out_unregister:
799− skl_platform_unregister(bus->dev);
800−out_dmic_free:
801− skl_dmic_device_unregister(skl);
802820 out_dsp_free:
803821 skl_free_dsp(skl);
804822 out_mach_free:
805823 skl_machine_device_unregister(skl);
806824 out_nhlt_free:
807825 skl_nhlt_free(skl->nhlt);
808−out_display_power_off:
809− if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
810− snd_hdac_display_power(bus, false);
811826 out_free:
812− skl->init_failed = 1;
813827 skl_free(ebus);
814828
815829 return err;
@@ -828,7 +842,7 @@ static void skl_shutdown(struct pci_dev *pci) · 12 unmodified lines
828842
829843 skl = ebus_to_skl(ebus);
830844
831− if (skl->init_failed)
845+ if (!skl->init_done)
832846 return;
833847
834848 snd_hdac_ext_stop_streams(ebus);
sound/soc/intel/skylake/skl.h+3−1
@@ -46,7 +46,7 @@ struct skl { · 45 unmodified lines
4646 struct hdac_ext_bus ebus;
4747 struct pci_dev *pci;
4848
49− unsigned int init_failed:1; /* delayed init failed */
49+ unsigned int init_done:1; /* delayed init status */
5050 struct platform_device *dmic_dev;
5151 struct platform_device *i2s_dev;
5252 struct snd_soc_platform *platform;
@@ -64,6 +64,8 @@ struct skl { · 11 unmodified lines
6464 const struct firmware *tplg;
6565
6666 int supend_active;
67+
68+ struct work_struct probe_work;
6769 };
6870
6971 #define skl_to_ebus(s) (&(s)->ebus)
sound/soc/sh/rcar/adg.c+4−2
@@ -507,7 +507,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, · 506 unmodified lines
507507 rbga = rbgx;
508508 adg->rbga_rate_for_441khz = rate / div;
509509 ckr |= brg_table[i] << 20;
510− if (req_441kHz_rate)
510+ if (req_441kHz_rate &&
511+ !(adg_mode_flags(adg) & AUDIO_OUT_48))
511512 parent_clk_name = __clk_get_name(clk);
512513 }
513514 }
@@ -522,7 +523,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, · 8 unmodified lines
522523 rbgb = rbgx;
523524 adg->rbgb_rate_for_48khz = rate / div;
524525 ckr |= brg_table[i] << 16;
525− if (req_48kHz_rate)
526+ if (req_48kHz_rate &&
527+ (adg_mode_flags(adg) & AUDIO_OUT_48))
526528 parent_clk_name = __clk_get_name(clk);
527529 }
528530 }
sound/soc/sh/rcar/cmd.c+1−0
@@ -89,6 +89,7 @@ static int rsnd_cmd_init(struct rsnd_mod *mod, · 88 unmodified lines
8989 dev_dbg(dev, "ctu/mix path = 0x%08x", data);
9090
9191 rsnd_mod_write(mod, CMD_ROUTE_SLCT, data);
92+ rsnd_mod_write(mod, CMD_BUSIF_MODE, rsnd_get_busif_shift(io, mod) | 1);
9293 rsnd_mod_write(mod, CMD_BUSIF_DALIGN, rsnd_get_dalign(mod, io));
9394
9495 rsnd_adg_set_cmd_timsel_gen2(mod, io);
sound/soc/sh/rcar/core.c+51−0
@@ -343,6 +343,57 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) · 342 unmodified lines
343343 return 0x76543210;
344344 }
345345
346+u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod)
347+{
348+ enum rsnd_mod_type playback_mods[] = {
349+ RSND_MOD_SRC,
350+ RSND_MOD_CMD,
351+ RSND_MOD_SSIU,
352+ };
353+ enum rsnd_mod_type capture_mods[] = {
354+ RSND_MOD_CMD,
355+ RSND_MOD_SRC,
356+ RSND_MOD_SSIU,
357+ };
358+ struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
359+ struct rsnd_mod *tmod = NULL;
360+ enum rsnd_mod_type *mods =
361+ rsnd_io_is_play(io) ?
362+ playback_mods : capture_mods;
363+ int i;
364+
365+ /*
366+ * This is needed for 24bit data
367+ * We need to shift 8bit
368+ *
369+ * Linux 24bit data is located as 0x00******
370+ * HW 24bit data is located as 0x******00
371+ *
372+ */
373+ switch (runtime->sample_bits) {
374+ case 16:
375+ return 0;
376+ case 32:
377+ break;
378+ }
379+
380+ for (i = 0; i < ARRAY_SIZE(playback_mods); i++) {
381+ tmod = rsnd_io_to_mod(io, mods[i]);
382+ if (tmod)
383+ break;
384+ }
385+
386+ if (tmod != mod)
387+ return 0;
388+
389+ if (rsnd_io_is_play(io))
390+ return (0 << 20) | /* shift to Left */
391+ (8 << 16); /* 8bit */
392+ else
393+ return (1 << 20) | /* shift to Right */
394+ (8 << 16); /* 8bit */
395+}
396+
346397 /*
347398 * rsnd_dai functions
348399 */
sound/soc/sh/rcar/gen.c+1−0
@@ -236,6 +236,7 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) · 235 unmodified lines
236236 RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc, 0x20),
237237 RSND_GEN_M_REG(SRC_CTRL, 0x10, 0x20),
238238 RSND_GEN_M_REG(SRC_INT_ENABLE0, 0x18, 0x20),
239+ RSND_GEN_M_REG(CMD_BUSIF_MODE, 0x184, 0x20),
239240 RSND_GEN_M_REG(CMD_BUSIF_DALIGN,0x188, 0x20),
240241 RSND_GEN_M_REG(CMD_ROUTE_SLCT, 0x18c, 0x20),
241242 RSND_GEN_M_REG(CMD_CTRL, 0x190, 0x20),
sound/soc/sh/rcar/rsnd.h+2−0
@@ -73,6 +73,7 @@ enum rsnd_reg { · 72 unmodified lines
7373 RSND_REG_SCU_SYS_INT_EN0,
7474 RSND_REG_SCU_SYS_INT_EN1,
7575 RSND_REG_CMD_CTRL,
76+ RSND_REG_CMD_BUSIF_MODE,
7677 RSND_REG_CMD_BUSIF_DALIGN,
7778 RSND_REG_CMD_ROUTE_SLCT,
7879 RSND_REG_CMDOUT_TIMSEL,
@@ -204,6 +205,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, · 125 unmodified lines
204205 u32 mask, u32 data);
205206 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
206207 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
208+u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
207209
208210 /*
209211 * R-Car DMA
sound/soc/sh/rcar/src.c+10−2
@@ -190,11 +190,13 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 189 unmodified lines
190190 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
191191 struct device *dev = rsnd_priv_to_dev(priv);
192192 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
193+ int is_play = rsnd_io_is_play(io);
193194 int use_src = 0;
194195 u32 fin, fout;
195196 u32 ifscr, fsrate, adinr;
196197 u32 cr, route;
197198 u32 bsdsr, bsisr;
199+ u32 i_busif, o_busif, tmp;
198200 uint ratio;
199201
200202 if (!runtime)
@@ -270,6 +272,11 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 69 unmodified lines
270272 break;
271273 }
272274
275+ /* BUSIF_MODE */
276+ tmp = rsnd_get_busif_shift(io, mod);
277+ i_busif = ( is_play ? tmp : 0) | 1;
278+ o_busif = (!is_play ? tmp : 0) | 1;
279+
273280 rsnd_mod_write(mod, SRC_ROUTE_MODE0, route);
274281
275282 rsnd_mod_write(mod, SRC_SRCIR, 1); /* initialize */
@@ -281,8 +288,9 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 5 unmodified lines
281288 rsnd_mod_write(mod, SRC_BSISR, bsisr);
282289 rsnd_mod_write(mod, SRC_SRCIR, 0); /* cancel initialize */
283290
284− rsnd_mod_write(mod, SRC_I_BUSIF_MODE, 1);
285− rsnd_mod_write(mod, SRC_O_BUSIF_MODE, 1);
291+ rsnd_mod_write(mod, SRC_I_BUSIF_MODE, i_busif);
292+ rsnd_mod_write(mod, SRC_O_BUSIF_MODE, o_busif);
293+
286294 rsnd_mod_write(mod, SRC_BUSIF_DALIGN, rsnd_get_dalign(mod, io));
287295
288296 rsnd_adg_set_src_timesel_gen2(mod, io, fin, fout);
sound/soc/sh/rcar/ssi.c+15−3
@@ -302,7 +302,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, · 301 unmodified lines
302302 * always use 32bit system word.
303303 * see also rsnd_ssi_master_clk_enable()
304304 */
305− cr_own = FORCE | SWL_32 | PDTA;
305+ cr_own = FORCE | SWL_32;
306306
307307 if (rdai->bit_clk_inv)
308308 cr_own |= SCKP;
@@ -550,6 +550,13 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, · 241 unmodified lines
550550 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
551551 u32 *buf = (u32 *)(runtime->dma_area +
552552 rsnd_dai_pointer_offset(io, 0));
553+ int shift = 0;
554+
555+ switch (runtime->sample_bits) {
556+ case 32:
557+ shift = 8;
558+ break;
559+ }
553560
554561 /*
555562 * 8/16/32 data can be assesse to TDR/RDR register
@@ -557,9 +564,9 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, · 1 unmodified line
557564 * see rsnd_ssi_init()
558565 */
559566 if (rsnd_io_is_play(io))
560− rsnd_mod_write(mod, SSITDR, *buf);
567+ rsnd_mod_write(mod, SSITDR, (*buf) << shift);
561568 else
562− *buf = rsnd_mod_read(mod, SSIRDR);
569+ *buf = (rsnd_mod_read(mod, SSIRDR) >> shift);
563570
564571 elapsed = rsnd_dai_pointer_update(io, sizeof(*buf));
565572 }
@@ -709,6 +716,11 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod, · 143 unmodified lines
709716 struct rsnd_priv *priv)
710717 {
711718 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
719+ struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
720+
721+ /* Do nothing for SSI parent mod */
722+ if (ssi_parent_mod == mod)
723+ return 0;
712724
713725 /* PIO will request IRQ again */
714726 free_irq(ssi->irq, mod);
sound/soc/sh/rcar/ssiu.c+2−1
@@ -144,7 +144,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, · 143 unmodified lines
144144 (rsnd_io_is_play(io) ?
145145 rsnd_runtime_channel_after_ctu(io) :
146146 rsnd_runtime_channel_original(io)));
147− rsnd_mod_write(mod, SSI_BUSIF_MODE, 1);
147+ rsnd_mod_write(mod, SSI_BUSIF_MODE,
148+ rsnd_get_busif_shift(io, mod) | 1);
148149 rsnd_mod_write(mod, SSI_BUSIF_DALIGN,
149150 rsnd_get_dalign(mod, io));
150151 }
sound/soc/soc-core.c+3−2
@@ -2286,6 +2286,9 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card) · 2285 unmodified lines
22862286 list_for_each_entry(rtd, &card->rtd_list, list)
22872287 flush_delayed_work(&rtd->delayed_work);
22882288
2289+ /* free the ALSA card at first; this syncs with pending operations */
2290+ snd_card_free(card->snd_card);
2291+
22892292 /* remove and free each DAI */
22902293 soc_remove_dai_links(card);
22912294 soc_remove_pcm_runtimes(card);
@@ -2300,9 +2303,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card) · 8 unmodified lines
23002303 if (card->remove)
23012304 card->remove(card);
23022305
2303− snd_card_free(card->snd_card);
23042306 return 0;
2305−
23062307 }
23072308
23082309 /* removes a socdev */
tools/perf/Documentation/perf-probe.txt+6−2
@@ -240,9 +240,13 @@ Add a probe on schedule() function 12th line with recording cpu local variable: · 239 unmodified lines
240240 or
241241 ./perf probe --add='schedule:12 cpu'
242242
243− this will add one or more probes which has the name start with "schedule".
243+Add one or more probes which has the name start with "schedule".
244244
245− Add probes on lines in schedule() function which calls update_rq_clock().
245+ ./perf probe schedule*
246+ or
247+ ./perf probe --add='schedule*'
248+
249+Add probes on lines in schedule() function which calls update_rq_clock().
246250
247251 ./perf probe 'schedule;update_rq_clock*'
248252 or
tools/perf/Documentation/perf-script-perl.txt+1−1
@@ -39,7 +39,7 @@ EVENT HANDLERS · 38 unmodified lines
3939 When perf script is invoked using a trace script, a user-defined
4040 'handler function' is called for each event in the trace. If there's
4141 no handler function defined for a given event type, the event is
42−ignored (or passed to a 'trace_handled' function, see below) and the
42+ignored (or passed to a 'trace_unhandled' function, see below) and the
4343 next event is processed.
4444
4545 Most of the event's field values are passed as arguments to the
tools/perf/Documentation/perf-script-python.txt+9−14
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, · 148 unmodified lines
149149 print "id=%d, args=%s\n" % \
150150 (id, args),
151151
152−def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
153− common_pid, common_comm):
154− print_header(event_name, common_cpu, common_secs, common_nsecs,
155− common_pid, common_comm)
152+def trace_unhandled(event_name, context, event_fields_dict):
153+ print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
156154
157155 def print_header(event_name, cpu, secs, nsecs, pid, comm):
158156 print "%-20s %5u %05u.%09u %8u %-20s " % \
@@ -321,7 +319,7 @@ So those are the essential steps in writing and running a script. The · 162 unmodified lines
321319 process can be generalized to any tracepoint or set of tracepoints
322320 you're interested in - basically find the tracepoint(s) you're
323321 interested in by looking at the list of available events shown by
324−'perf list' and/or look in /sys/kernel/debug/tracing events for
322+'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
325323 detailed event and field info, record the corresponding trace data
326324 using 'perf record', passing it the list of interesting events,
327325 generate a skeleton script using 'perf script -g python' and modify the
@@ -334,7 +332,7 @@ right place, you can have your script listed alongside the other · 6 unmodified lines
334332 scripts listed by the 'perf script -l' command e.g.:
335333
336334 ----
337−root@tropicana:~# perf script -l
335+# perf script -l
338336 List of available trace scripts:
339337 wakeup-latency system-wide min/max/avg wakeup latency
340338 rw-by-file <comm> r/w activity for a program, by file
@@ -383,8 +381,6 @@ source tree: · 42 unmodified lines
383381
384382 ----
385383 # ls -al kernel-source/tools/perf/scripts/python
386−
387−root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
388384 total 32
389385 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
390386 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
@@ -399,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l' · 8 unmodified lines
399395 should show a new entry for your script:
400396
401397 ----
402−root@tropicana:~# perf script -l
398+# perf script -l
403399 List of available trace scripts:
404400 wakeup-latency system-wide min/max/avg wakeup latency
405401 rw-by-file <comm> r/w activity for a program, by file
@@ -437,7 +433,7 @@ EVENT HANDLERS · 31 unmodified lines
437433 When perf script is invoked using a trace script, a user-defined
438434 'handler function' is called for each event in the trace. If there's
439435 no handler function defined for a given event type, the event is
440−ignored (or passed to a 'trace_handled' function, see below) and the
436+ignored (or passed to a 'trace_unhandled' function, see below) and the
441437 next event is processed.
442438
443439 Most of the event's field values are passed as arguments to the
@@ -532,7 +528,7 @@ can implement a set of optional functions: · 88 unmodified lines
532528 gives scripts a chance to do setup tasks:
533529
534530 ----
535−def trace_begin:
531+def trace_begin():
536532 pass
537533 ----
538534
@@ -541,7 +537,7 @@ def trace_begin: · 2 unmodified lines
541537 as display results:
542538
543539 ----
544−def trace_end:
540+def trace_end():
545541 pass
546542 ----
547543
@@ -550,8 +546,7 @@ def trace_end: · 2 unmodified lines
550546 of common arguments are passed into it:
551547
552548 ----
553−def trace_unhandled(event_name, context, common_cpu, common_secs,
554− common_nsecs, common_pid, common_comm):
549+def trace_unhandled(event_name, context, event_fields_dict):
555550 pass
556551 ----
557552
tools/perf/arch/common.c+1−0
@@ -26,6 +26,7 @@ const char *const arm64_triplets[] = { · 25 unmodified lines
2626
2727 const char *const powerpc_triplets[] = {
2828 "powerpc-unknown-linux-gnu-",
29+ "powerpc-linux-gnu-",
2930 "powerpc64-unknown-linux-gnu-",
3031 "powerpc64-linux-gnu-",
3132 "powerpc64le-linux-gnu-",
tools/perf/builtin-stat.c+4−1
@@ -1578,6 +1578,7 @@ static void print_header(int argc, const char **argv) · 1577 unmodified lines
15781578 static void print_footer(void)
15791579 {
15801580 FILE *output = stat_config.output;
1581+ int n;
15811582
15821583 if (!null_run)
15831584 fprintf(output, "\n");
@@ -1590,7 +1591,9 @@ static void print_footer(void) · 6 unmodified lines
15901591 }
15911592 fprintf(output, "\n\n");
15921593
1593− if (print_free_counters_hint)
1594+ if (print_free_counters_hint &&
1595+ sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 &&
1596+ n > 0)
15941597 fprintf(output,
15951598 "Some events weren't counted. Try disabling the NMI watchdog:\n"
15961599 " echo 0 > /proc/sys/kernel/nmi_watchdog\n"
tools/perf/builtin-trace.c+4−0
@@ -681,6 +681,10 @@ static struct syscall_fmt { · 680 unmodified lines
681681 { .name = "mlockall", .errmsg = true,
682682 .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
683683 { .name = "mmap", .hexret = true,
684+/* The standard mmap maps to old_mmap on s390x */
685+#if defined(__s390x__)
686+ .alias = "old_mmap",
687+#endif
684688 .arg_scnprintf = { [0] = SCA_HEX, /* addr */
685689 [2] = SCA_MMAP_PROT, /* prot */
686690 [3] = SCA_MMAP_FLAGS, /* flags */ }, },
tools/perf/tests/bp_signal.c+14−0
@@ -288,3 +288,17 @@ int test__bp_signal(int subtest __maybe_unused) · 287 unmodified lines
288288 return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ?
289289 TEST_OK : TEST_FAIL;
290290 }
291+
292+bool test__bp_signal_is_supported(void)
293+{
294+/*
295+ * The powerpc so far does not have support to even create
296+ * instruction breakpoint using the perf event interface.
297+ * Once it's there we can release this.
298+ */
299+#ifdef __powerpc__
300+ return false;
301+#else
302+ return true;
303+#endif
304+}
tools/perf/tests/builtin-test.c+7−0
@@ -97,10 +97,12 @@ static struct test generic_tests[] = { · 96 unmodified lines
9797 {
9898 .desc = "Breakpoint overflow signal handler",
9999 .func = test__bp_signal,
100+ .is_supported = test__bp_signal_is_supported,
100101 },
101102 {
102103 .desc = "Breakpoint overflow sampling",
103104 .func = test__bp_signal_overflow,
105+ .is_supported = test__bp_signal_is_supported,
104106 },
105107 {
106108 .desc = "Number of exit events of a simple workload",
@@ -401,6 +403,11 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) · 294 unmodified lines
401403 if (!perf_test__matches(t, curr, argc, argv))
402404 continue;
403405
406+ if (t->is_supported && !t->is_supported()) {
407+ pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc);
408+ continue;
409+ }
410+
404411 pr_info("%2d: %-*s:", i, width, t->desc);
405412
406413 if (intlist__find(skiplist, i)) {
tools/perf/tests/code-reading.c+19−1
@@ -229,6 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 228 unmodified lines
229229 unsigned char buf2[BUFSZ];
230230 size_t ret_len;
231231 u64 objdump_addr;
232+ const char *objdump_name;
233+ char decomp_name[KMOD_DECOMP_LEN];
232234 int ret;
233235
234236 pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr);
@@ -289,9 +291,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 54 unmodified lines
289291 state->done[state->done_cnt++] = al.map->start;
290292 }
291293
294+ objdump_name = al.map->dso->long_name;
295+ if (dso__needs_decompress(al.map->dso)) {
296+ if (dso__decompress_kmodule_path(al.map->dso, objdump_name,
297+ decomp_name,
298+ sizeof(decomp_name)) < 0) {
299+ pr_debug("decompression failed\n");
300+ return -1;
301+ }
302+
303+ objdump_name = decomp_name;
304+ }
305+
292306 /* Read the object code using objdump */
293307 objdump_addr = map__rip_2objdump(al.map, al.addr);
294− ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len);
308+ ret = read_via_objdump(objdump_name, objdump_addr, buf2, len);
309+
310+ if (dso__needs_decompress(al.map->dso))
311+ unlink(objdump_name);
312+
295313 if (ret > 0) {
296314 /*
297315 * The kernel maps are inaccurate - assume objdump is right in
tools/perf/tests/tests.h+3−0
@@ -34,6 +34,7 @@ struct test { · 33 unmodified lines
3434 int (*get_nr)(void);
3535 const char *(*get_desc)(int subtest);
3636 } subtest;
37+ bool (*is_supported)(void);
3738 };
3839
3940 /* Tests */
@@ -99,6 +100,8 @@ const char *test__clang_subtest_get_desc(int subtest); · 59 unmodified lines
99100 int test__clang_subtest_get_nr(void);
100101 int test__unit_number__scnprint(int subtest);
101102
103+bool test__bp_signal_is_supported(void);
104+
102105 #if defined(__arm__) || defined(__aarch64__)
103106 #ifdef HAVE_DWARF_UNWIND_SUPPORT
104107 struct thread;
tools/perf/util/annotate.c+43−29
@@ -239,10 +239,20 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 238 unmodified lines
239239 const char *s = strchr(ops->raw, '+');
240240 const char *c = strchr(ops->raw, ',');
241241
242− if (c++ != NULL)
242+ /*
243+ * skip over possible up to 2 operands to get to address, e.g.:
244+ * tbnz w0, #26, ffff0000083cd190 <security_file_permission+0xd0>
245+ */
246+ if (c++ != NULL) {
243247 ops->target.addr = strtoull(c, NULL, 16);
244− else
248+ if (!ops->target.addr) {
249+ c = strchr(c, ',');
250+ if (c++ != NULL)
251+ ops->target.addr = strtoull(c, NULL, 16);
252+ }
253+ } else {
245254 ops->target.addr = strtoull(ops->raw, NULL, 16);
255+ }
246256
247257 if (s++ != NULL) {
248258 ops->target.offset = strtoull(s, NULL, 16);
@@ -257,10 +267,27 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 8 unmodified lines
257267 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
258268 struct ins_operands *ops)
259269 {
270+ const char *c = strchr(ops->raw, ',');
271+
260272 if (!ops->target.addr || ops->target.offset < 0)
261273 return ins__raw_scnprintf(ins, bf, size, ops);
262274
263− return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset);
275+ if (c != NULL) {
276+ const char *c2 = strchr(c + 1, ',');
277+
278+ /* check for 3-op insn */
279+ if (c2 != NULL)
280+ c = c2;
281+ c++;
282+
283+ /* mirror arch objdump's space-after-comma style */
284+ if (*c == ' ')
285+ c++;
286+ }
287+
288+ return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64,
289+ ins->name, c ? c - ops->raw : 0, ops->raw,
290+ ops->target.offset);
264291 }
265292
266293 static struct ins_ops jump_ops = {
@@ -1294,6 +1321,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 1027 unmodified lines
12941321 char linkname[PATH_MAX];
12951322 char *build_id_filename;
12961323 char *build_id_path = NULL;
1324+ char *pos;
12971325
12981326 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
12991327 !dso__is_kcore(dso))
@@ -1313,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 13 unmodified lines
13131341 if (!build_id_path)
13141342 return -1;
13151343
1316− dirname(build_id_path);
1344+ /*
1345+ * old style build-id cache has name of XX/XXXXXXX.. while
1346+ * new style has XX/XXXXXXX../{elf,kallsyms,vdso}.
1347+ * extract the build-id part of dirname in the new style only.
1348+ */
1349+ pos = strrchr(build_id_path, '/');
1350+ if (pos && strlen(pos) < SBUILD_ID_SIZE - 2)
1351+ dirname(build_id_path);
13171352
13181353 if (dso__is_kcore(dso) ||
13191354 readlink(build_id_path, linkname, sizeof(linkname)) < 0 ||
@@ -1396,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 76 unmodified lines
13961431 sizeof(symfs_filename));
13971432 }
13981433 } else if (dso__needs_decompress(dso)) {
1399− char tmp[PATH_MAX];
1400− struct kmod_path m;
1401− int fd;
1402− bool ret;
1403−
1404− if (kmod_path__parse_ext(&m, symfs_filename))
1405− goto out;
1406−
1407− snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX");
1408−
1409− fd = mkstemp(tmp);
1410− if (fd < 0) {
1411− free(m.ext);
1412− goto out;
1413− }
1414−
1415− ret = decompress_to_file(m.ext, symfs_filename, fd);
1416−
1417− if (ret)
1418− pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename);
1419−
1420− free(m.ext);
1421− close(fd);
1434+ char tmp[KMOD_DECOMP_LEN];
14221435
1423− if (!ret)
1436+ if (dso__decompress_kmodule_path(dso, symfs_filename,
1437+ tmp, sizeof(tmp)) < 0)
14241438 goto out;
14251439
14261440 strcpy(symfs_filename, tmp);
@@ -1429,7 +1443,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 2 unmodified lines
14291443 snprintf(command, sizeof(command),
14301444 "%s %s%s --start-address=0x%016" PRIx64
14311445 " --stop-address=0x%016" PRIx64
1432− " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand",
1446+ " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
14331447 objdump_path ? objdump_path : "objdump",
14341448 disassembler_style ? "-M " : "",
14351449 disassembler_style ? disassembler_style : "",
tools/perf/util/build-id.c+0−45
@@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) · 277 unmodified lines
278278 return bf;
279279 }
280280
281−bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size)
282−{
283− char *id_name = NULL, *ch;
284− struct stat sb;
285− char sbuild_id[SBUILD_ID_SIZE];
286−
287− if (!dso->has_build_id)
288− goto err;
289−
290− build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
291− id_name = build_id_cache__linkname(sbuild_id, NULL, 0);
292− if (!id_name)
293− goto err;
294− if (access(id_name, F_OK))
295− goto err;
296− if (lstat(id_name, &sb) == -1)
297− goto err;
298− if ((size_t)sb.st_size > size - 1)
299− goto err;
300− if (readlink(id_name, bf, size - 1) < 0)
301− goto err;
302−
303− bf[sb.st_size] = '\0';
304−
305− /*
306− * link should be:
307− * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92
308− */
309− ch = strrchr(bf, '/');
310− if (!ch)
311− goto err;
312− if (ch - 3 < bf)
313− goto err;
314−
315− free(id_name);
316− return strncmp(".ko", ch - 3, 3) == 0;
317−err:
318− pr_err("Invalid build id: %s\n", id_name ? :
319− dso->long_name ? :
320− dso->short_name ? :
321− "[unknown]");
322− free(id_name);
323− return false;
324−}
325−
326281 #define dsos__for_each_with_build_id(pos, head) \
327282 list_for_each_entry(pos, head, node) \
328283 if (!pos->has_build_id) \
tools/perf/util/build-id.h+0−1
@@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, · 16 unmodified lines
1717 size_t size);
1818
1919 char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size);
20−bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size);
2120
2221 int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
2322 struct perf_sample *sample, struct perf_evsel *evsel,
tools/perf/util/dso.c+94−6
@@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso) · 247 unmodified lines
248248 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
249249 }
250250
251+static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf)
252+{
253+ int fd = -1;
254+ struct kmod_path m;
255+
256+ if (!dso__needs_decompress(dso))
257+ return -1;
258+
259+ if (kmod_path__parse_ext(&m, dso->long_name))
260+ return -1;
261+
262+ if (!m.comp)
263+ goto out;
264+
265+ fd = mkstemp(tmpbuf);
266+ if (fd < 0) {
267+ dso->load_errno = errno;
268+ goto out;
269+ }
270+
271+ if (!decompress_to_file(m.ext, name, fd)) {
272+ dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE;
273+ close(fd);
274+ fd = -1;
275+ }
276+
277+out:
278+ free(m.ext);
279+ return fd;
280+}
281+
282+int dso__decompress_kmodule_fd(struct dso *dso, const char *name)
283+{
284+ char tmpbuf[] = KMOD_DECOMP_NAME;
285+ int fd;
286+
287+ fd = decompress_kmodule(dso, name, tmpbuf);
288+ unlink(tmpbuf);
289+ return fd;
290+}
291+
292+int dso__decompress_kmodule_path(struct dso *dso, const char *name,
293+ char *pathname, size_t len)
294+{
295+ char tmpbuf[] = KMOD_DECOMP_NAME;
296+ int fd;
297+
298+ fd = decompress_kmodule(dso, name, tmpbuf);
299+ if (fd < 0) {
300+ unlink(tmpbuf);
301+ return -1;
302+ }
303+
304+ strncpy(pathname, tmpbuf, len);
305+ close(fd);
306+ return 0;
307+}
308+
251309 /*
252310 * Parses kernel module specified in @path and updates
253311 * @m argument like:
@@ -335,6 +393,21 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 81 unmodified lines
335393 return 0;
336394 }
337395
396+void dso__set_module_info(struct dso *dso, struct kmod_path *m,
397+ struct machine *machine)
398+{
399+ if (machine__is_host(machine))
400+ dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE;
401+ else
402+ dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE;
403+
404+ /* _KMODULE_COMP should be next to _KMODULE */
405+ if (m->kmod && m->comp)
406+ dso->symtab_type++;
407+
408+ dso__set_short_name(dso, strdup(m->name), true);
409+}
410+
338411 /*
339412 * Global list of open DSOs and the counter.
340413 */
@@ -381,7 +454,7 @@ static int do_open(char *name) · 40 unmodified lines
381454
382455 static int __open_dso(struct dso *dso, struct machine *machine)
383456 {
384− int fd;
457+ int fd = -EINVAL;
385458 char *root_dir = (char *)"";
386459 char *name = malloc(PATH_MAX);
387460
@@ -392,15 +465,30 @@ static int __open_dso(struct dso *dso, struct machine *machine) · 4 unmodified lines
392465 root_dir = machine->root_dir;
393466
394467 if (dso__read_binary_type_filename(dso, dso->binary_type,
395− root_dir, name, PATH_MAX)) {
396− free(name);
397− return -EINVAL;
398− }
468+ root_dir, name, PATH_MAX))
469+ goto out;
399470
400471 if (!is_regular_file(name))
401− return -EINVAL;
472+ goto out;
473+
474+ if (dso__needs_decompress(dso)) {
475+ char newpath[KMOD_DECOMP_LEN];
476+ size_t len = sizeof(newpath);
477+
478+ if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) {
479+ fd = -dso->load_errno;
480+ goto out;
481+ }
482+
483+ strcpy(name, newpath);
484+ }
402485
403486 fd = do_open(name);
487+
488+ if (dso__needs_decompress(dso))
489+ unlink(name);
490+
491+out:
404492 free(name);
405493 return fd;
406494 }
tools/perf/util/dso.h+9−0
@@ -244,6 +244,12 @@ bool is_supported_compression(const char *ext); · 243 unmodified lines
244244 bool is_kernel_module(const char *pathname, int cpumode);
245245 bool decompress_to_file(const char *ext, const char *filename, int output_fd);
246246 bool dso__needs_decompress(struct dso *dso);
247+int dso__decompress_kmodule_fd(struct dso *dso, const char *name);
248+int dso__decompress_kmodule_path(struct dso *dso, const char *name,
249+ char *pathname, size_t len);
250+
251+#define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX"
252+#define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME)
247253
248254 struct kmod_path {
249255 char *name;
@@ -259,6 +265,9 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 9 unmodified lines
259265 #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
260266 #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true)
261267
268+void dso__set_module_info(struct dso *dso, struct kmod_path *m,
269+ struct machine *machine);
270+
262271 /*
263272 * The dso__data_* external interface provides following functions:
264273 * dso__data_get_fd
tools/perf/util/header.c+10−2
@@ -1469,8 +1469,16 @@ static int __event_process_build_id(struct build_id_event *bev, · 1468 unmodified lines
14691469
14701470 dso__set_build_id(dso, &bev->build_id);
14711471
1472− if (!is_kernel_module(filename, cpumode))
1473− dso->kernel = dso_type;
1472+ if (dso_type != DSO_TYPE_USER) {
1473+ struct kmod_path m = { .name = NULL, };
1474+
1475+ if (!kmod_path__parse_name(&m, filename) && m.kmod)
1476+ dso__set_module_info(dso, &m, machine);
1477+ else
1478+ dso->kernel = dso_type;
1479+
1480+ free(m.name);
1481+ }
14741482
14751483 build_id__sprintf(dso->build_id, sizeof(dso->build_id),
14761484 sbuild_id);
tools/perf/util/machine.c+1−10
@@ -572,16 +572,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine, · 571 unmodified lines
572572 if (dso == NULL)
573573 goto out_unlock;
574574
575− if (machine__is_host(machine))
576− dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE;
577− else
578− dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE;
579−
580− /* _KMODULE_COMP should be next to _KMODULE */
581− if (m->kmod && m->comp)
582− dso->symtab_type++;
583−
584− dso__set_short_name(dso, strdup(m->name), true);
575+ dso__set_module_info(dso, m, machine);
585576 dso__set_long_name(dso, strdup(filename), true);
586577 }
587578
tools/perf/util/scripting-engines/trace-event-python.c+1−1
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) · 1218 unmodified lines
12191219 fprintf(ofp, "# be retrieved using Python functions of the form "
12201220 "common_*(context).\n");
12211221
1222− fprintf(ofp, "# See the perf-trace-python Documentation for the list "
1222+ fprintf(ofp, "# See the perf-script-python Documentation for the list "
12231223 "of available functions.\n\n");
12241224
12251225 fprintf(ofp, "import os\n");
tools/perf/util/symbol-elf.c+3−38
@@ -637,43 +637,6 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata) · 636 unmodified lines
637637 return 0;
638638 }
639639
640−static int decompress_kmodule(struct dso *dso, const char *name,
641− enum dso_binary_type type)
642−{
643− int fd = -1;
644− char tmpbuf[] = "/tmp/perf-kmod-XXXXXX";
645− struct kmod_path m;
646−
647− if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP &&
648− type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP &&
649− type != DSO_BINARY_TYPE__BUILD_ID_CACHE)
650− return -1;
651−
652− if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE)
653− name = dso->long_name;
654−
655− if (kmod_path__parse_ext(&m, name) || !m.comp)
656− return -1;
657−
658− fd = mkstemp(tmpbuf);
659− if (fd < 0) {
660− dso->load_errno = errno;
661− goto out;
662− }
663−
664− if (!decompress_to_file(m.ext, name, fd)) {
665− dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE;
666− close(fd);
667− fd = -1;
668− }
669−
670− unlink(tmpbuf);
671−
672−out:
673− free(m.ext);
674− return fd;
675−}
676−
677640 bool symsrc__possibly_runtime(struct symsrc *ss)
678641 {
679642 return ss->dynsym || ss->opdsec;
@@ -705,9 +668,11 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, · 25 unmodified lines
705668 int fd;
706669
707670 if (dso__needs_decompress(dso)) {
708− fd = decompress_kmodule(dso, name, type);
671+ fd = dso__decompress_kmodule_fd(dso, name);
709672 if (fd < 0)
710673 return -1;
674+
675+ type = dso->symtab_type;
711676 } else {
712677 fd = open(name, O_RDONLY);
713678 if (fd < 0) {
tools/perf/util/symbol.c+0−4
@@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map) · 1561 unmodified lines
15621562 if (!runtime_ss && syms_ss)
15631563 runtime_ss = syms_ss;
15641564
1565− if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE)
1566− if (dso__build_id_is_kmod(dso, name, PATH_MAX))
1567− kmod = true;
1568−
15691565 if (syms_ss)
15701566 ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod);
15711567 else
tools/perf/util/unwind-libdw.c+9−1
@@ -39,6 +39,14 @@ static int __report_module(struct addr_location *al, u64 ip, · 38 unmodified lines
3939 return 0;
4040
4141 mod = dwfl_addrmodule(ui->dwfl, ip);
42+ if (mod) {
43+ Dwarf_Addr s;
44+
45+ dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL);
46+ if (s != al->map->start)
47+ mod = 0;
48+ }
49+
4250 if (!mod)
4351 mod = dwfl_report_elf(ui->dwfl, dso->short_name,
4452 dso->long_name, -1, al->map->start,
@@ -224,7 +232,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, · 179 unmodified lines
224232
225233 err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui);
226234
227− if (err && !ui->max_stack)
235+ if (err && ui->max_stack != max_stack)
228236 err = 0;
229237
230238 /*
tools/testing/selftests/bpf/bpf_endian.h+30−11
@@ -1,23 +1,42 @@
11 #ifndef __BPF_ENDIAN__
22 #define __BPF_ENDIAN__
33
4−#include <asm/byteorder.h>
4+#include <linux/swab.h>
55
6−#if __BYTE_ORDER == __LITTLE_ENDIAN
7−# define __bpf_ntohs(x) __builtin_bswap16(x)
8−# define __bpf_htons(x) __builtin_bswap16(x)
9−#elif __BYTE_ORDER == __BIG_ENDIAN
10−# define __bpf_ntohs(x) (x)
11−# define __bpf_htons(x) (x)
6+/* LLVM's BPF target selects the endianness of the CPU
7+ * it compiles on, or the user specifies (bpfel/bpfeb),
8+ * respectively. The used __BYTE_ORDER__ is defined by
9+ * the compiler, we cannot rely on __BYTE_ORDER from
10+ * libc headers, since it doesn't reflect the actual
11+ * requested byte order.
12+ *
13+ * Note, LLVM's BPF target has different __builtin_bswapX()
14+ * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE
15+ * in bpfel and bpfeb case, which means below, that we map
16+ * to cpu_to_be16(). We could use it unconditionally in BPF
17+ * case, but better not rely on it, so that this header here
18+ * can be used from application and BPF program side, which
19+ * use different targets.
20+ */
21+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
22+# define __bpf_ntohs(x) __builtin_bswap16(x)
23+# define __bpf_htons(x) __builtin_bswap16(x)
24+# define __bpf_constant_ntohs(x) ___constant_swab16(x)
25+# define __bpf_constant_htons(x) ___constant_swab16(x)
26+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
27+# define __bpf_ntohs(x) (x)
28+# define __bpf_htons(x) (x)
29+# define __bpf_constant_ntohs(x) (x)
30+# define __bpf_constant_htons(x) (x)
1231 #else
13−# error "Fix your __BYTE_ORDER?!"
32+# error "Fix your compiler's __BYTE_ORDER__?!"
1433 #endif
1534
1635 #define bpf_htons(x) \
1736 (__builtin_constant_p(x) ? \
18− __constant_htons(x) : __bpf_htons(x))
37+ __bpf_constant_htons(x) : __bpf_htons(x))
1938 #define bpf_ntohs(x) \
2039 (__builtin_constant_p(x) ? \
21− __constant_ntohs(x) : __bpf_ntohs(x))
40+ __bpf_constant_ntohs(x) : __bpf_ntohs(x))
2241
23−#endif
42+#endif /* __BPF_ENDIAN__ */
virt/kvm/arm/hyp/vgic-v3-sr.c+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include <asm/kvm_hyp.h>
2323
2424 #define vtr_to_max_lr_idx(v) ((v) & 0xf)
25−#define vtr_to_nr_pre_bits(v) (((u32)(v) >> 26) + 1)
25+#define vtr_to_nr_pre_bits(v) ((((u32)(v) >> 26) & 7) + 1)
2626
2727 static u64 __hyp_text __gic_v3_get_lr(unsigned int lr)
2828 {
virt/kvm/arm/mmu.c+3−0
@@ -879,6 +879,9 @@ static pmd_t *stage2_get_pmd(struct kvm *kvm, struct kvm_mmu_memory_cache *cache · 878 unmodified lines
879879 pmd_t *pmd;
880880
881881 pud = stage2_get_pud(kvm, cache, addr);
882+ if (!pud)
883+ return NULL;
884+
882885 if (stage2_pud_none(*pud)) {
883886 if (!cache)
884887 return NULL;
virt/kvm/arm/vgic/vgic-mmio-v2.c+14−2
@@ -226,7 +226,13 @@ static unsigned long vgic_mmio_read_vcpuif(struct kvm_vcpu *vcpu, · 225 unmodified lines
226226
227227 switch (addr & 0xff) {
228228 case GIC_CPU_CTRL:
229− val = vmcr.ctlr;
229+ val = vmcr.grpen0 << GIC_CPU_CTRL_EnableGrp0_SHIFT;
230+ val |= vmcr.grpen1 << GIC_CPU_CTRL_EnableGrp1_SHIFT;
231+ val |= vmcr.ackctl << GIC_CPU_CTRL_AckCtl_SHIFT;
232+ val |= vmcr.fiqen << GIC_CPU_CTRL_FIQEn_SHIFT;
233+ val |= vmcr.cbpr << GIC_CPU_CTRL_CBPR_SHIFT;
234+ val |= vmcr.eoim << GIC_CPU_CTRL_EOImodeNS_SHIFT;
235+
230236 break;
231237 case GIC_CPU_PRIMASK:
232238 /*
@@ -267,7 +273,13 @@ static void vgic_mmio_write_vcpuif(struct kvm_vcpu *vcpu, · 34 unmodified lines
267273
268274 switch (addr & 0xff) {
269275 case GIC_CPU_CTRL:
270− vmcr.ctlr = val;
276+ vmcr.grpen0 = !!(val & GIC_CPU_CTRL_EnableGrp0);
277+ vmcr.grpen1 = !!(val & GIC_CPU_CTRL_EnableGrp1);
278+ vmcr.ackctl = !!(val & GIC_CPU_CTRL_AckCtl);
279+ vmcr.fiqen = !!(val & GIC_CPU_CTRL_FIQEn);
280+ vmcr.cbpr = !!(val & GIC_CPU_CTRL_CBPR);
281+ vmcr.eoim = !!(val & GIC_CPU_CTRL_EOImodeNS);
282+
271283 break;
272284 case GIC_CPU_PRIMASK:
273285 /*
virt/kvm/arm/vgic/vgic-v2.c+25−3
@@ -177,7 +177,18 @@ void vgic_v2_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 176 unmodified lines
177177 struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2;
178178 u32 vmcr;
179179
180− vmcr = (vmcrp->ctlr << GICH_VMCR_CTRL_SHIFT) & GICH_VMCR_CTRL_MASK;
180+ vmcr = (vmcrp->grpen0 << GICH_VMCR_ENABLE_GRP0_SHIFT) &
181+ GICH_VMCR_ENABLE_GRP0_MASK;
182+ vmcr |= (vmcrp->grpen1 << GICH_VMCR_ENABLE_GRP1_SHIFT) &
183+ GICH_VMCR_ENABLE_GRP1_MASK;
184+ vmcr |= (vmcrp->ackctl << GICH_VMCR_ACK_CTL_SHIFT) &
185+ GICH_VMCR_ACK_CTL_MASK;
186+ vmcr |= (vmcrp->fiqen << GICH_VMCR_FIQ_EN_SHIFT) &
187+ GICH_VMCR_FIQ_EN_MASK;
188+ vmcr |= (vmcrp->cbpr << GICH_VMCR_CBPR_SHIFT) &
189+ GICH_VMCR_CBPR_MASK;
190+ vmcr |= (vmcrp->eoim << GICH_VMCR_EOI_MODE_SHIFT) &
191+ GICH_VMCR_EOI_MODE_MASK;
181192 vmcr |= (vmcrp->abpr << GICH_VMCR_ALIAS_BINPOINT_SHIFT) &
182193 GICH_VMCR_ALIAS_BINPOINT_MASK;
183194 vmcr |= (vmcrp->bpr << GICH_VMCR_BINPOINT_SHIFT) &
@@ -195,8 +206,19 @@ void vgic_v2_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 11 unmodified lines
195206
196207 vmcr = cpu_if->vgic_vmcr;
197208
198− vmcrp->ctlr = (vmcr & GICH_VMCR_CTRL_MASK) >>
199− GICH_VMCR_CTRL_SHIFT;
209+ vmcrp->grpen0 = (vmcr & GICH_VMCR_ENABLE_GRP0_MASK) >>
210+ GICH_VMCR_ENABLE_GRP0_SHIFT;
211+ vmcrp->grpen1 = (vmcr & GICH_VMCR_ENABLE_GRP1_MASK) >>
212+ GICH_VMCR_ENABLE_GRP1_SHIFT;
213+ vmcrp->ackctl = (vmcr & GICH_VMCR_ACK_CTL_MASK) >>
214+ GICH_VMCR_ACK_CTL_SHIFT;
215+ vmcrp->fiqen = (vmcr & GICH_VMCR_FIQ_EN_MASK) >>
216+ GICH_VMCR_FIQ_EN_SHIFT;
217+ vmcrp->cbpr = (vmcr & GICH_VMCR_CBPR_MASK) >>
218+ GICH_VMCR_CBPR_SHIFT;
219+ vmcrp->eoim = (vmcr & GICH_VMCR_EOI_MODE_MASK) >>
220+ GICH_VMCR_EOI_MODE_SHIFT;
221+
200222 vmcrp->abpr = (vmcr & GICH_VMCR_ALIAS_BINPOINT_MASK) >>
201223 GICH_VMCR_ALIAS_BINPOINT_SHIFT;
202224 vmcrp->bpr = (vmcr & GICH_VMCR_BINPOINT_MASK) >>
virt/kvm/arm/vgic/vgic-v3.c+33−14
@@ -159,15 +159,24 @@ void vgic_v3_clear_lr(struct kvm_vcpu *vcpu, int lr) · 158 unmodified lines
159159 void vgic_v3_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp)
160160 {
161161 struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3;
162+ u32 model = vcpu->kvm->arch.vgic.vgic_model;
162163 u32 vmcr;
163164
164− /*
165− * Ignore the FIQen bit, because GIC emulation always implies
166− * SRE=1 which means the vFIQEn bit is also RES1.
167− */
168− vmcr = ((vmcrp->ctlr >> ICC_CTLR_EL1_EOImode_SHIFT) <<
169− ICH_VMCR_EOIM_SHIFT) & ICH_VMCR_EOIM_MASK;
170− vmcr |= (vmcrp->ctlr << ICH_VMCR_CBPR_SHIFT) & ICH_VMCR_CBPR_MASK;
165+ if (model == KVM_DEV_TYPE_ARM_VGIC_V2) {
166+ vmcr = (vmcrp->ackctl << ICH_VMCR_ACK_CTL_SHIFT) &
167+ ICH_VMCR_ACK_CTL_MASK;
168+ vmcr |= (vmcrp->fiqen << ICH_VMCR_FIQ_EN_SHIFT) &
169+ ICH_VMCR_FIQ_EN_MASK;
170+ } else {
171+ /*
172+ * When emulating GICv3 on GICv3 with SRE=1 on the
173+ * VFIQEn bit is RES1 and the VAckCtl bit is RES0.
174+ */
175+ vmcr = ICH_VMCR_FIQ_EN_MASK;
176+ }
177+
178+ vmcr |= (vmcrp->cbpr << ICH_VMCR_CBPR_SHIFT) & ICH_VMCR_CBPR_MASK;
179+ vmcr |= (vmcrp->eoim << ICH_VMCR_EOIM_SHIFT) & ICH_VMCR_EOIM_MASK;
171180 vmcr |= (vmcrp->abpr << ICH_VMCR_BPR1_SHIFT) & ICH_VMCR_BPR1_MASK;
172181 vmcr |= (vmcrp->bpr << ICH_VMCR_BPR0_SHIFT) & ICH_VMCR_BPR0_MASK;
173182 vmcr |= (vmcrp->pmr << ICH_VMCR_PMR_SHIFT) & ICH_VMCR_PMR_MASK;
@@ -180,17 +189,27 @@ void vgic_v3_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 6 unmodified lines
180189 void vgic_v3_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp)
181190 {
182191 struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3;
192+ u32 model = vcpu->kvm->arch.vgic.vgic_model;
183193 u32 vmcr;
184194
185195 vmcr = cpu_if->vgic_vmcr;
186196
187− /*
188− * Ignore the FIQen bit, because GIC emulation always implies
189− * SRE=1 which means the vFIQEn bit is also RES1.
190− */
191− vmcrp->ctlr = ((vmcr >> ICH_VMCR_EOIM_SHIFT) <<
192− ICC_CTLR_EL1_EOImode_SHIFT) & ICC_CTLR_EL1_EOImode_MASK;
193− vmcrp->ctlr |= (vmcr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT;
197+ if (model == KVM_DEV_TYPE_ARM_VGIC_V2) {
198+ vmcrp->ackctl = (vmcr & ICH_VMCR_ACK_CTL_MASK) >>
199+ ICH_VMCR_ACK_CTL_SHIFT;
200+ vmcrp->fiqen = (vmcr & ICH_VMCR_FIQ_EN_MASK) >>
201+ ICH_VMCR_FIQ_EN_SHIFT;
202+ } else {
203+ /*
204+ * When emulating GICv3 on GICv3 with SRE=1 on the
205+ * VFIQEn bit is RES1 and the VAckCtl bit is RES0.
206+ */
207+ vmcrp->fiqen = 1;
208+ vmcrp->ackctl = 0;
209+ }
210+
211+ vmcrp->cbpr = (vmcr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT;
212+ vmcrp->eoim = (vmcr & ICH_VMCR_EOIM_MASK) >> ICH_VMCR_EOIM_SHIFT;
194213 vmcrp->abpr = (vmcr & ICH_VMCR_BPR1_MASK) >> ICH_VMCR_BPR1_SHIFT;
195214 vmcrp->bpr = (vmcr & ICH_VMCR_BPR0_MASK) >> ICH_VMCR_BPR0_SHIFT;
196215 vmcrp->pmr = (vmcr & ICH_VMCR_PMR_MASK) >> ICH_VMCR_PMR_SHIFT;
virt/kvm/arm/vgic/vgic.h+8−4
@@ -111,14 +111,18 @@ static inline bool irq_is_pending(struct vgic_irq *irq) · 110 unmodified lines
111111 * registers regardless of the hardware backed GIC used.
112112 */
113113 struct vgic_vmcr {
114− u32 ctlr;
114+ u32 grpen0;
115+ u32 grpen1;
116+
117+ u32 ackctl;
118+ u32 fiqen;
119+ u32 cbpr;
120+ u32 eoim;
121+
115122 u32 abpr;
116123 u32 bpr;
117124 u32 pmr; /* Priority mask field in the GICC_PMR and
118125 * ICC_PMR_EL1 priority field format */
119− /* Below member variable are valid only for GICv3 */
120− u32 grpen0;
121− u32 grpen1;
122126 };
123127
124128 struct vgic_reg_attr {