History

Merge tag 'v4.19-rc6' into for-4.20/block

Merge -rc6 in, for two reasons: 1) Resolve a trivial conflict in the blk-mq-tag.c documentation 2) A few important regression fixes went into upstream directly, so they aren't in the 4.20 branch. Signed-off-by: Jens Axboe <axboe@kernel.dk> * tag 'v4.19-rc6': (780 commits) Linux 4.19-rc6 MAINTAINERS: fix reference to moved drivers/{misc => auxdisplay}/panel.c cpufreq: qcom-kryo: Fix section annotations perf/core: Add sanity check to deal with pinned event failure xen/blkfront: correct purging of persistent grants Revert "xen/blkfront: When purging persistent grants, keep them in the buffer" selftests/powerpc: Fix Makefiles for headers_install change blk-mq: I/O and timer unplugs are inverted in blktrace dax: Fix deadlock in dax_lock_mapping_entry() x86/boot: Fix kexec booting failure in the SEV bit detection code bcache: add separate workqueue for journal_write to avoid deadlock drm/amd/display: Fix Edid emulation for linux drm/amd/display: Fix Vega10 lightup on S3 resume drm/amdgpu: Fix vce work queue was not cancelled when suspend Revert "drm/panel: Add device_link from panel device to DRM device" xen/blkfront: When purging persistent grants, keep them in the buffer clocksource/drivers/timer-atmel-pit: Properly handle error cases block: fix deadline elevator drain for zoned block devices ACPI / hotplug / PCI: Don't scan for non-hotplug bridges if slot is not bridge drm/syncobj: Don't leak fences when WAIT_FOR_SUBMIT is set ...

Jens Axboe committed 8 years ago

Commit c0aac682 parents 451bb7c 17b57b1846 files · +8074 −4530Browse files

Unified · Split

846 files
  1. Documentation/ABI/stable/sysfs-devices-system-xen_memory +9 −0
  2. Documentation/admin-guide/kernel-parameters.txt +12 −0
  3. Documentation/device-mapper/dm-raid.txt +4 −0
  4. Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt +1 −2
  5. Documentation/devicetree/bindings/input/gpio-keys.txt +1 −1
  6. Documentation/devicetree/bindings/net/macb.txt +1 −0
  7. Documentation/filesystems/vfs.txt +19 −2
  8. Documentation/media/uapi/dvb/video_function_calls.rst +0 −1
  9. Documentation/process/changes.rst +1 −1
  10. Documentation/process/code-of-conduct.rst +81 −0
  11. Documentation/process/code-of-conflict.rst +0 −28
  12. Documentation/process/index.rst +1 −1
  13. Documentation/virtual/kvm/api.txt +11 −1
  14. Documentation/x86/earlyprintk.txt +15 −10
  15. MAINTAINERS +48 −15
  16. Makefile +7 −17
  17. arch/arc/Kconfig +5 −5
  18. arch/arc/Makefile +1 −9
  19. arch/arc/boot/dts/axc003.dtsi +26 −0
  20. arch/arc/boot/dts/axc003_idu.dtsi +26 −0
  21. arch/arc/boot/dts/axs10x_mb.dtsi +6 −1
  22. arch/arc/boot/dts/hsdk.dts +10 −1
  23. arch/arc/configs/axs101_defconfig +0 −3
  24. arch/arc/configs/axs103_defconfig +0 −3
  25. arch/arc/configs/axs103_smp_defconfig +0 −3
  26. arch/arc/configs/haps_hs_defconfig +0 −2
  27. arch/arc/configs/haps_hs_smp_defconfig +0 −2
  28. arch/arc/configs/hsdk_defconfig +0 −1
  29. arch/arc/configs/nps_defconfig +0 −1
  30. arch/arc/configs/nsim_700_defconfig +0 −2
  31. arch/arc/configs/nsim_hs_defconfig +0 −2
  32. arch/arc/configs/nsim_hs_smp_defconfig +0 −2
  33. arch/arc/configs/nsimosci_defconfig +0 −2
  34. arch/arc/configs/nsimosci_hs_defconfig +0 −2
  35. arch/arc/configs/nsimosci_hs_smp_defconfig +0 −2
  36. arch/arc/configs/tb10x_defconfig +0 −1
  37. arch/arc/configs/vdk_hs38_defconfig +0 −2
  38. arch/arc/configs/vdk_hs38_smp_defconfig +0 −1
  39. arch/arc/include/asm/atomic.h +1 −1
  40. arch/arc/include/asm/dma-mapping.h +13 −0
  41. arch/arc/kernel/troubleshoot.c +4 −9
  42. arch/arc/mm/cache.c +21 −15
  43. arch/arc/mm/dma.c +41 −41
  44. arch/arm/boot/dts/sama5d3_emac.dtsi +1 −1
  45. arch/arm/include/asm/kvm_host.h +0 −1
  46. arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +2 −0
  47. arch/arm64/include/asm/jump_label.h +2 −2
  48. arch/arm64/include/asm/kvm_host.h +1 −3
  49. arch/arm64/kernel/Makefile +1 −0
  50. arch/arm64/kernel/crash_core.c +19 −0
  51. arch/arm64/kernel/machine_kexec.c +0 −11
  52. arch/arm64/kvm/hyp/switch.c +6 −3
  53. arch/arm64/mm/mmu.c +6 −4
  54. arch/hexagon/include/asm/bitops.h +2 −2
  55. arch/hexagon/kernel/dma.c +1 −1
  56. arch/m68k/mm/mcfmmu.c +1 −1
  57. arch/mips/include/asm/kvm_host.h +0 −1
  58. arch/mips/include/asm/mach-lantiq/xway/xway_dma.h +1 −0
  59. arch/mips/kernel/vdso.c +20 −0
  60. arch/mips/kvm/mmu.c +0 −10
  61. arch/mips/lantiq/xway/dma.c +2 −2
  62. arch/powerpc/include/asm/book3s/64/pgtable.h +0 −1
  63. arch/powerpc/include/asm/iommu.h +0 −2
  64. arch/powerpc/include/asm/mmu_context.h +1 −0
  65. arch/powerpc/include/asm/setup.h +1 −0
  66. arch/powerpc/kernel/exceptions-64s.S +2 −2
  67. arch/powerpc/kernel/iommu.c +0 −25
  68. arch/powerpc/kernel/tm.S +17 −3
  69. arch/powerpc/kvm/book3s_64_mmu_hv.c +1 −1
  70. arch/powerpc/kvm/book3s_64_mmu_radix.c +40 −57
  71. arch/powerpc/kvm/book3s_64_vio_hv.c +31 −8
  72. arch/powerpc/lib/checksum_64.S +3 −0
  73. arch/powerpc/lib/code-patching.c +6 −0
  74. arch/powerpc/mm/init_64.c +0 −49
  75. arch/powerpc/mm/mem.c +2 −0
  76. arch/powerpc/mm/mmu_context_iommu.c +30 −4
  77. arch/powerpc/mm/numa.c +5 −2
  78. arch/powerpc/mm/pkeys.c +1 −1
  79. arch/powerpc/platforms/powernv/pci-ioda-tce.c +1 −1
  80. arch/riscv/include/asm/asm-prototypes.h +7 −0
  81. arch/riscv/kernel/setup.c +0 −7
  82. arch/s390/crypto/paes_s390.c +1 −1
  83. arch/s390/include/asm/mmu.h +7 −1
  84. arch/s390/kvm/kvm-s390.c +4 −2
  85. arch/s390/kvm/priv.c +18 −12
  86. arch/s390/kvm/vsie.c +2 −1
  87. arch/s390/mm/gmap.c +3 −1
  88. arch/x86/boot/compressed/mem_encrypt.S +0 −19
  89. arch/x86/crypto/aegis128-aesni-glue.c +0 −1
  90. arch/x86/crypto/aegis128l-aesni-glue.c +0 −1
  91. arch/x86/crypto/aegis256-aesni-glue.c +0 −1
  92. arch/x86/crypto/morus1280-sse2-glue.c +0 −1
  93. arch/x86/crypto/morus640-sse2-glue.c +0 −1
  94. arch/x86/events/intel/lbr.c +4 −0
  95. arch/x86/hyperv/hv_apic.c +4 −4
  96. arch/x86/include/asm/atomic.h +6 −6
  97. arch/x86/include/asm/atomic64_32.h +4 −4
  98. arch/x86/include/asm/atomic64_64.h +6 −6
  99. arch/x86/include/asm/fixmap.h +10 −0
  100. arch/x86/include/asm/hyperv-tlfs.h +9 −7
  101. arch/x86/include/asm/kdebug.h +11 −1
  102. arch/x86/include/asm/kvm_host.h +12 −15
  103. arch/x86/include/asm/mem_encrypt.h +7 −0
  104. arch/x86/include/asm/pgtable-2level.h +0 −9
  105. arch/x86/include/asm/pgtable.h +1 −1
  106. arch/x86/include/asm/pgtable_64.h +12 −11
  107. arch/x86/include/uapi/asm/kvm.h +1 −0
  108. arch/x86/kernel/apic/vector.c +1 −1
  109. arch/x86/kernel/apm_32.c +2 −0
  110. arch/x86/kernel/cpu/intel_rdt.h +13 −4
  111. arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +14 −13
  112. arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +44 −9
  113. arch/x86/kernel/cpu/microcode/amd.c +16 −8
  114. arch/x86/kernel/cpu/microcode/intel.c +12 −5
  115. arch/x86/kernel/dumpstack.c +3 −8
  116. arch/x86/kernel/eisa.c +8 −2
  117. arch/x86/kernel/head64.c +19 −1
  118. arch/x86/kernel/head_64.S +12 −4
  119. arch/x86/kernel/kvmclock.c +49 −3
  120. arch/x86/kernel/paravirt.c +2 −2
  121. arch/x86/kernel/process_32.c +2 −2
  122. arch/x86/kernel/process_64.c +10 −2
  123. arch/x86/kernel/topology.c +3 −1
  124. arch/x86/kernel/tsc.c +1 −1
  125. arch/x86/kernel/vmlinux.lds.S +19 −0
  126. arch/x86/kvm/lapic.c +39 −10
  127. arch/x86/kvm/mmu.c +22 −13
  128. arch/x86/kvm/svm.c +13 −13
  129. arch/x86/kvm/vmx.c +131 −50
  130. arch/x86/kvm/x86.c +88 −41
  131. arch/x86/kvm/x86.h +2 −0
  132. arch/x86/mm/init.c +4 −0
  133. arch/x86/mm/mem_encrypt.c +24 −0
  134. arch/x86/mm/pgtable.c +13 −4
  135. arch/x86/platform/efi/efi_32.c +1 −2
  136. arch/x86/xen/mmu_pv.c +6 −2
  137. arch/x86/xen/pmu.c +1 −1
  138. arch/xtensa/Kconfig +1 −0
  139. arch/xtensa/Makefile +0 −4
  140. arch/xtensa/platforms/iss/setup.c +15 −10
  141. block/bio.c +1 −1
  142. block/blk-cgroup.c +3 −1
  143. block/blk-core.c +1 −3
  144. block/blk-mq-tag.c +2 −5
  145. block/blk-mq.c +2 −2
  146. block/elevator.c +1 −1
  147. block/genhd.c +3 −3
  148. block/partition-generic.c +3 −3
  149. drivers/acpi/acpi_lpss.c +1 −1
  150. drivers/acpi/bus.c +7 −6
  151. drivers/android/binder_alloc.c +35 −8
  152. drivers/ata/libata-core.c +12 −2
  153. drivers/base/firmware_loader/main.c +18 −12
  154. drivers/block/floppy.c +3 −0
  155. drivers/block/null_blk.h +10 −7
  156. drivers/block/null_blk_main.c +38 −7
  157. drivers/block/null_blk_zoned.c +14 −20
  158. drivers/block/rbd.c +178 −57
  159. drivers/block/xen-blkfront.c +2 −2
  160. drivers/bluetooth/hci_ldisc.c +2 −0
  161. drivers/char/Kconfig +2 −2
  162. drivers/char/ipmi/ipmi_bt_sm.c +48 −44
  163. drivers/char/ipmi/ipmi_msghandler.c +30 −23
  164. drivers/char/ipmi/ipmi_si_intf.c +4 −13
  165. drivers/char/ipmi/ipmi_ssif.c +11 −21
  166. drivers/char/ipmi/kcs_bmc.c +4 −3
  167. drivers/char/random.c +8 −3
  168. drivers/clk/x86/clk-pmc-atom.c +11 −7
  169. drivers/clocksource/timer-atmel-pit.c +14 −6
  170. drivers/clocksource/timer-fttmr010.c +11 −7
  171. drivers/clocksource/timer-ti-32k.c +3 −0
  172. drivers/cpufreq/qcom-cpufreq-kryo.c +2 −2
  173. drivers/crypto/ccp/psp-dev.c +41 −5
  174. drivers/dax/device.c +6 −0
  175. drivers/dma/mic_x100_dma.c +1 −3
  176. drivers/firmware/arm_scmi/perf.c +7 −1
  177. drivers/firmware/efi/Kconfig +6 −3
  178. drivers/fpga/dfl-fme-pr.c +1 −1
  179. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 −1
  180. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 −1
  181. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +1 −1
  182. drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +8 −6
  183. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 −9
  184. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 −1
  185. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  186. drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 −1
  187. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 −2
  188. drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 −2
  189. drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 −1
  190. drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +12 −1
  191. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 −1
  192. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 −0
  193. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +16 −5
  194. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +134 −5
  195. drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 −2
  196. drivers/gpu/drm/amd/display/dc/dc_link.h +1 −0
  197. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 −1
  198. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h +0 −5
  199. drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.c +0 −12
  200. drivers/gpu/drm/amd/include/kgd_kfd_interface.h +1 −1
  201. drivers/gpu/drm/arm/malidp_drv.c +1 −0
  202. drivers/gpu/drm/arm/malidp_hw.c +23 −2
  203. drivers/gpu/drm/arm/malidp_hw.h +2 −1
  204. drivers/gpu/drm/arm/malidp_mw.c +21 −4
  205. drivers/gpu/drm/arm/malidp_regs.h +2 −0
  206. drivers/gpu/drm/drm_atomic.c +1 −1
  207. drivers/gpu/drm/drm_debugfs.c +1 −1
  208. drivers/gpu/drm/drm_fb_helper.c +0 −3
  209. drivers/gpu/drm/drm_panel.c +0 −10
  210. drivers/gpu/drm/drm_syncobj.c +5 −0
  211. drivers/gpu/drm/etnaviv/etnaviv_drv.c +21 −6
  212. drivers/gpu/drm/i915/gvt/dmabuf.c +26 −7
  213. drivers/gpu/drm/i915/gvt/fb_decoder.c +2 −3
  214. drivers/gpu/drm/i915/gvt/fb_decoder.h +1 −1
  215. drivers/gpu/drm/i915/gvt/handlers.c +28 −6
  216. drivers/gpu/drm/i915/gvt/kvmgt.c +14 −3
  217. drivers/gpu/drm/i915/gvt/mmio.c +28 −0
  218. drivers/gpu/drm/i915/gvt/mmio_context.c +0 −2
  219. drivers/gpu/drm/i915/gvt/opregion.c +9 −11
  220. drivers/gpu/drm/i915/gvt/sched_policy.c +30 −7
  221. drivers/gpu/drm/i915/gvt/vgpu.c +1 −0
  222. drivers/gpu/drm/i915/i915_reg.h +2 −2
  223. drivers/gpu/drm/i915/intel_ddi.c +9 −8
  224. drivers/gpu/drm/i915/intel_display.c +6 −2
  225. drivers/gpu/drm/i915/intel_dp.c +19 −14
  226. drivers/gpu/drm/i915/intel_dp_mst.c +4 −0
  227. drivers/gpu/drm/i915/intel_overlay.c +75 −153
  228. drivers/gpu/drm/nouveau/dispnv50/disp.c +49 −18
  229. drivers/gpu/drm/nouveau/nouveau_connector.c +60 −50
  230. drivers/gpu/drm/nouveau/nouveau_display.c +32 −12
  231. drivers/gpu/drm/nouveau/nouveau_display.h +1 −1
  232. drivers/gpu/drm/nouveau/nouveau_drm.c +9 −12
  233. drivers/gpu/drm/nouveau/nouveau_fbcon.c +57 −0
  234. drivers/gpu/drm/nouveau/nouveau_fbcon.h +5 −0
  235. drivers/gpu/drm/nouveau/nouveau_vga.c +0 −2
  236. drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +14 −0
  237. drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c +46 −8
  238. drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +1 −0
  239. drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +3 −3
  240. drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c +14 −4
  241. drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h +3 −2
  242. drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm200.c +13 −11
  243. drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +1 −1
  244. drivers/gpu/drm/pl111/pl111_vexpress.c +2 −1
  245. drivers/gpu/drm/sun4i/sun4i_drv.c +0 −1
  246. drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +0 −1
  247. drivers/gpu/drm/sun4i/sun8i_mixer.c +0 −24
  248. drivers/gpu/drm/sun4i/sun8i_tcon_top.c +0 −1
  249. drivers/gpu/drm/udl/udl_fb.c +5 −3
  250. drivers/gpu/drm/vc4/vc4_plane.c +12 −13
  251. drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +1 −1
  252. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +30 −12
  253. drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +0 −25
  254. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +14 −10
  255. drivers/gpu/vga/vga_switcheroo.c +2 −0
  256. drivers/hid/hid-apple.c +8 −1
  257. drivers/hid/hid-core.c +4 −1
  258. drivers/hid/hid-ids.h +3 −3
  259. drivers/hid/hid-input.c +3 −2
  260. drivers/hid/hid-multitouch.c +17 −2
  261. drivers/hid/hid-saitek.c +2 −0
  262. drivers/hid/hid-sensor-hub.c +23 −0
  263. drivers/hid/i2c-hid/i2c-hid.c +7 −4
  264. drivers/hid/intel-ish-hid/ipc/hw-ish.h +1 −0
  265. drivers/hid/intel-ish-hid/ipc/pci-ish.c +1 −0
  266. drivers/hv/vmbus_drv.c +3 −0
  267. drivers/hwmon/nct6775.c +49 −23
  268. drivers/hwmon/raspberrypi-hwmon.c +1 −0
  269. drivers/hwtracing/intel_th/core.c +13 −3
  270. drivers/hwtracing/intel_th/pci.c +5 −0
  271. drivers/i2c/busses/i2c-i801.c +6 −1
  272. drivers/i2c/busses/i2c-imx-lpi2c.c +0 −1
  273. drivers/i2c/busses/i2c-uniphier-f.c +2 −5
  274. drivers/i2c/busses/i2c-uniphier.c +2 −5
  275. drivers/i2c/busses/i2c-xiic.c +4 −0
  276. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +6 −7
  277. drivers/iio/temperature/maxim_thermocouple.c +0 −1
  278. drivers/infiniband/core/cache.c +34 −34
  279. drivers/infiniband/core/cma.c +7 −5
  280. drivers/infiniband/core/rdma_core.c +2 −0
  281. drivers/infiniband/core/ucma.c +8 −0
  282. drivers/infiniband/core/uverbs_cmd.c +45 −23
  283. drivers/infiniband/core/uverbs_main.c +3 −3
  284. drivers/infiniband/core/uverbs_uapi.c +1 −0
  285. drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 −0
  286. drivers/infiniband/hw/bnxt_re/main.c +38 −55
  287. drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 −1
  288. drivers/infiniband/hw/cxgb4/qp.c +6 −0
  289. drivers/infiniband/hw/hfi1/chip.c +5 −1
  290. drivers/infiniband/hw/hfi1/pcie.c +4 −7
  291. drivers/infiniband/hw/hfi1/pio.c +41 −10
  292. drivers/infiniband/hw/hfi1/pio.h +2 −0
  293. drivers/infiniband/hw/hfi1/user_sdma.c +1 −1
  294. drivers/infiniband/hw/hfi1/verbs.c +7 −1
  295. drivers/infiniband/hw/mlx4/main.c +5 −3
  296. drivers/infiniband/hw/mlx5/devx.c +4 −1
  297. drivers/infiniband/ulp/ipoib/ipoib_cm.c +2 −0
  298. drivers/infiniband/ulp/srp/ib_srp.c +3 −3
  299. drivers/input/keyboard/atakbd.c +28 −46
  300. drivers/input/misc/uinput.c +1 −1
  301. drivers/input/mouse/elantech.c +2 −0
  302. drivers/input/touchscreen/egalax_ts.c +6 −0
  303. drivers/iommu/amd_iommu.c +6 −0
  304. drivers/iommu/intel-iommu.c +3 −3
  305. drivers/iommu/intel-pasid.h +1 −1
  306. drivers/iommu/rockchip-iommu.c +6 −0
  307. drivers/irqchip/irq-gic-v3-its.c +3 −1
  308. drivers/md/bcache/bcache.h +1 −0
  309. drivers/md/bcache/journal.c +3 −3
  310. drivers/md/bcache/super.c +8 −0
  311. drivers/md/dm-crypt.c +5 −5
  312. drivers/md/dm-integrity.c +2 −2
  313. drivers/md/dm-raid.c +61 −93
  314. drivers/md/dm-thin-metadata.c +35 −1
  315. drivers/md/dm-thin.c +65 −8
  316. drivers/md/dm-verity-target.c +20 −4
  317. drivers/md/md-cluster.c +5 −5
  318. drivers/md/raid10.c +4 −1
  319. drivers/md/raid5-log.h +5 −0
  320. drivers/md/raid5.c +3 −3
  321. drivers/media/i2c/mt9v111.c +13 −28
  322. drivers/media/platform/Kconfig +2 −0
  323. drivers/media/platform/qcom/camss/camss-csid.c +1 −0
  324. drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c +1 −0
  325. drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +1 −0
  326. drivers/media/platform/qcom/camss/camss-csiphy.c +1 −0
  327. drivers/media/platform/qcom/camss/camss-ispif.c +3 −2
  328. drivers/media/platform/qcom/camss/camss-vfe-4-1.c +1 −0
  329. drivers/media/platform/qcom/camss/camss-vfe-4-7.c +1 −0
  330. drivers/media/platform/qcom/camss/camss.c +8 −7
  331. drivers/media/usb/dvb-usb-v2/af9035.c +4 −2
  332. drivers/memory/ti-aemif.c +1 −1
  333. drivers/mfd/omap-usb-host.c +6 −5
  334. drivers/misc/hmc6352.c +2 −0
  335. drivers/misc/ibmvmc.c +1 −1
  336. drivers/misc/mei/bus.c +5 −7
  337. drivers/misc/mei/client.c +1 −1
  338. drivers/misc/mei/hbm.c +6 −3
  339. drivers/mmc/host/meson-mx-sdio.c +6 −2
  340. drivers/mmc/host/omap_hsmmc.c +1 −0
  341. drivers/mtd/devices/m25p80.c +23 −3
  342. drivers/mtd/mtdpart.c +4 −1
  343. drivers/mtd/nand/raw/denali.c +6 −0
  344. drivers/mtd/nand/raw/marvell_nand.c +3 −1
  345. drivers/net/appletalk/ipddp.c +6 −2
  346. drivers/net/bonding/bond_main.c +2 −9
  347. drivers/net/dsa/mv88e6xxx/global1.h +1 −1
  348. drivers/net/dsa/mv88e6xxx/global1_atu.c +1 −1
  349. drivers/net/ethernet/amazon/ena/ena_com.c +11 −13
  350. drivers/net/ethernet/amazon/ena/ena_eth_com.c +6 −0
  351. drivers/net/ethernet/amazon/ena/ena_eth_com.h +2 −6
  352. drivers/net/ethernet/amazon/ena/ena_netdev.c +37 −45
  353. drivers/net/ethernet/amazon/ena/ena_netdev.h +11 −0
  354. drivers/net/ethernet/apple/bmac.c +2 −2
  355. drivers/net/ethernet/apple/mace.c +2 −2
  356. drivers/net/ethernet/apple/macmace.c +2 −2
  357. drivers/net/ethernet/aquantia/atlantic/aq_ring.c +18 −14
  358. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +0 −16
  359. drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 −20
  360. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +3 −0
  361. drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +5 −4
  362. drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h +1 −1
  363. drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +14 −6
  364. drivers/net/ethernet/cadence/macb_main.c +8 −0
  365. drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +0 −1
  366. drivers/net/ethernet/cirrus/ep93xx_eth.c +1 −1
  367. drivers/net/ethernet/cirrus/mac89x0.c +2 −2
  368. drivers/net/ethernet/emulex/benet/be_cmds.c +1 −1
  369. drivers/net/ethernet/hp/hp100.c +1 −1
  370. drivers/net/ethernet/i825xx/ether1.c +3 −2
  371. drivers/net/ethernet/i825xx/lib82596.c +2 −2
  372. drivers/net/ethernet/i825xx/sun3_82586.c +4 −2
  373. drivers/net/ethernet/ibm/emac/core.c +10 −5
  374. drivers/net/ethernet/intel/fm10k/fm10k.h +0 −3
  375. drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +0 −3
  376. drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 −22
  377. drivers/net/ethernet/intel/i40evf/i40evf_main.c +0 −26
  378. drivers/net/ethernet/intel/ice/ice_main.c +0 −27
  379. drivers/net/ethernet/intel/igb/igb_main.c +0 −30
  380. drivers/net/ethernet/intel/ixgb/ixgb_main.c +0 −25
  381. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 −25
  382. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +0 −21
  383. drivers/net/ethernet/lantiq_etop.c +1 −0
  384. drivers/net/ethernet/marvell/mvneta.c +6 −7
  385. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +12 −19
  386. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 −20
  387. drivers/net/ethernet/mellanox/mlx4/eq.c +2 −1
  388. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 −1
  389. drivers/net/ethernet/mellanox/mlx5/core/dev.c +14 −8
  390. drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +2 −1
  391. drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 −1
  392. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 −19
  393. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 −0
  394. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +39 −37
  395. drivers/net/ethernet/mellanox/mlx5/core/health.c +9 −1
  396. drivers/net/ethernet/mellanox/mlx5/core/main.c +7 −5
  397. drivers/net/ethernet/mellanox/mlx5/core/transobj.c +1 −1
  398. drivers/net/ethernet/mellanox/mlx5/core/wq.c +3 −3
  399. drivers/net/ethernet/mellanox/mlx5/core/wq.h +1 −1
  400. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 −2
  401. drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +8 −8
  402. drivers/net/ethernet/microchip/lan743x_main.c +3 −3
  403. drivers/net/ethernet/mscc/ocelot_board.c +9 −3
  404. drivers/net/ethernet/netronome/nfp/flower/action.c +6 −0
  405. drivers/net/ethernet/netronome/nfp/flower/main.h +1 −0
  406. drivers/net/ethernet/netronome/nfp/flower/match.c +1 −1
  407. drivers/net/ethernet/netronome/nfp/flower/offload.c +11 −0
  408. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +0 −18
  409. drivers/net/ethernet/qlogic/qed/qed_dcbx.c +28 −17
  410. drivers/net/ethernet/qlogic/qed/qed_dcbx.h +1 −0
  411. drivers/net/ethernet/qlogic/qed/qed_dev.c +14 −1
  412. drivers/net/ethernet/qlogic/qed/qed_hsi.h +4 −0
  413. drivers/net/ethernet/qlogic/qed/qed_mcp.c +20 −4
  414. drivers/net/ethernet/qlogic/qed/qed_reg_addr.h +6 −0
  415. drivers/net/ethernet/qualcomm/qca_7k.c +36 −40
  416. drivers/net/ethernet/qualcomm/qca_spi.c +57 −53
  417. drivers/net/ethernet/qualcomm/qca_spi.h +0 −5
  418. drivers/net/ethernet/realtek/r8169.c +55 −5
  419. drivers/net/ethernet/renesas/Kconfig +1 −0
  420. drivers/net/ethernet/renesas/Makefile +1 −0
  421. drivers/net/ethernet/renesas/ravb.h +5 −0
  422. drivers/net/ethernet/renesas/ravb_main.c +6 −5
  423. drivers/net/ethernet/renesas/ravb_ptp.c +2 −6
  424. drivers/net/ethernet/seeq/ether3.c +3 −2
  425. drivers/net/ethernet/seeq/sgiseeq.c +2 −1
  426. drivers/net/ethernet/sgi/ioc3-eth.c +2 −2
  427. drivers/net/ethernet/sgi/meth.c +1 −1
  428. drivers/net/ethernet/stmicro/stmmac/common.h +2 −2
  429. drivers/net/ethernet/stmicro/stmmac/stmmac.h +12 −2
  430. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +134 −104
  431. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 −3
  432. drivers/net/ethernet/ti/Kconfig +1 −0
  433. drivers/net/ethernet/wiznet/w5100.c +1 −1
  434. drivers/net/ethernet/wiznet/w5300.c +1 −1
  435. drivers/net/hyperv/netvsc.c +3 −0
  436. drivers/net/hyperv/netvsc_drv.c +36 −31
  437. drivers/net/phy/sfp-bus.c +2 −2
  438. drivers/net/ppp/pppoe.c +3 −0
  439. drivers/net/tun.c +0 −43
  440. drivers/net/usb/qmi_wwan.c +36 −8
  441. drivers/net/veth.c +2 −2
  442. drivers/net/xen-netfront.c +17 −15
  443. drivers/nvme/host/multipath.c +4 −2
  444. drivers/nvme/target/admin-cmd.c +4 −0
  445. drivers/nvme/target/rdma.c +25 −2
  446. drivers/of/base.c +3 −0
  447. drivers/pci/controller/dwc/pcie-designware.c +4 −4
  448. drivers/pci/controller/dwc/pcie-designware.h +1 −2
  449. drivers/pci/controller/pci-hyperv.c +39 −0
  450. drivers/pci/hotplug/acpiphp_glue.c +6 −5
  451. drivers/pci/hotplug/pciehp_hpc.c +9 −9
  452. drivers/pci/pci.c +2 −1
  453. drivers/pci/probe.c +4 −1
  454. drivers/pci/quirks.c +0 −6
  455. drivers/pci/switch/switchtec.c +4 −0
  456. drivers/pinctrl/cirrus/pinctrl-madera-core.c +1 −1
  457. drivers/pinctrl/intel/pinctrl-cannonlake.c +21 −14
  458. drivers/pinctrl/intel/pinctrl-intel.c +63 −80
  459. drivers/pinctrl/pinctrl-amd.c +23 −10
  460. drivers/pinctrl/pinctrl-ingenic.c +2 −2
  461. drivers/pinctrl/qcom/pinctrl-msm.c +24 −0
  462. drivers/platform/x86/alienware-wmi.c +1 −0
  463. drivers/platform/x86/dell-smbios-wmi.c +1 −0
  464. drivers/regulator/bd71837-regulator.c +19 −0
  465. drivers/regulator/core.c +2 −2
  466. drivers/regulator/of_regulator.c +0 −2
  467. drivers/s390/crypto/ap_bus.c +33 −53
  468. drivers/s390/net/qeth_core_main.c +8 −3
  469. drivers/s390/net/qeth_l2_main.c +1 −1
  470. drivers/s390/net/qeth_l3_main.c +1 −1
  471. drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +2 −3
  472. drivers/scsi/ipr.c +61 −45
  473. drivers/scsi/ipr.h +1 −0
  474. drivers/scsi/lpfc/lpfc_attr.c +10 −5
  475. drivers/scsi/lpfc/lpfc_debugfs.c +5 −5
  476. drivers/scsi/lpfc/lpfc_nvme.c +8 −3
  477. drivers/scsi/qedi/qedi.h +6 −1
  478. drivers/scsi/qedi/qedi_main.c +15 −13
  479. drivers/scsi/qla2xxx/qla_target.h +2 −2
  480. drivers/scsi/sd.c +5 −1
  481. drivers/scsi/ufs/ufshcd.c +7 −0
  482. drivers/soundwire/stream.c +17 −6
  483. drivers/spi/spi-fsl-dspi.c +6 −0
  484. drivers/spi/spi-gpio.c +2 −2
  485. drivers/spi/spi-rspi.c +30 −4
  486. drivers/spi/spi-sh-msiof.c +27 −1
  487. drivers/spi/spi-tegra20-slink.c +23 −8
  488. drivers/spi/spi.c +11 −2
  489. drivers/staging/erofs/Kconfig +1 −1
  490. drivers/staging/erofs/super.c +2 −2
  491. drivers/staging/fbtft/TODO +4 −0
  492. drivers/staging/gasket/TODO +13 −0
  493. drivers/staging/media/mt9t031/Kconfig +0 −6
  494. drivers/staging/vboxvideo/vbox_drv.c +7 −0
  495. drivers/staging/vboxvideo/vbox_mode.c +5 −0
  496. drivers/staging/wilc1000/Makefile +1 −2
  497. drivers/staging/wilc1000/linux_wlan.c +4 −2
  498. drivers/staging/wilc1000/wilc_debugfs.c +5 −2
  499. drivers/staging/wilc1000/wilc_wlan.c +6 −0
  500. drivers/staging/wilc1000/wilc_wlan_if.h +0 −2
  501. drivers/target/iscsi/iscsi_target.c +15 −16
  502. drivers/target/iscsi/iscsi_target_auth.c +17 −28
  503. drivers/target/iscsi/iscsi_target_login.c +78 −71
  504. drivers/target/iscsi/iscsi_target_login.h +1 −1
  505. drivers/tty/hvc/hvc_console.c +33 −5
  506. drivers/tty/serial/cpm_uart/cpm_uart_core.c +7 −3
  507. drivers/tty/serial/fsl_lpuart.c +2 −1
  508. drivers/tty/serial/imx.c +8 −0
  509. drivers/tty/serial/mvebu-uart.c +1 −0
  510. drivers/tty/tty_io.c +8 −3
  511. drivers/tty/vt/vt_ioctl.c +4 −0
  512. drivers/usb/class/cdc-acm.c +0 −73
  513. drivers/usb/class/cdc-acm.h +0 −1
  514. drivers/usb/common/common.c +25 −0
  515. drivers/usb/common/roles.c +12 −3
  516. drivers/usb/core/devio.c +21 −3
  517. drivers/usb/core/driver.c +14 −14
  518. drivers/usb/core/hcd-pci.c +0 −2
  519. drivers/usb/core/message.c +11 −0
  520. drivers/usb/core/of.c +0 −26
  521. drivers/usb/core/quirks.c +9 −1
  522. drivers/usb/core/usb.c +2 −0
  523. drivers/usb/dwc2/platform.c +2 −2
  524. drivers/usb/dwc3/dwc3-of-simple.c +4 −6
  525. drivers/usb/dwc3/dwc3-pci.c +2 −2
  526. drivers/usb/dwc3/gadget.c +0 −1
  527. drivers/usb/gadget/udc/fotg210-udc.c +10 −5
  528. drivers/usb/gadget/udc/net2280.c +14 −2
  529. drivers/usb/gadget/udc/renesas_usb3.c +4 −1
  530. drivers/usb/host/u132-hcd.c +1 −1
  531. drivers/usb/host/xhci-mem.c +4 −0
  532. drivers/usb/host/xhci-plat.c +16 −11
  533. drivers/usb/host/xhci.c +30 −0
  534. drivers/usb/misc/uss720.c +2 −2
  535. drivers/usb/misc/yurex.c +6 −2
  536. drivers/usb/mtu3/mtu3_core.c +5 −1
  537. drivers/usb/mtu3/mtu3_hw_regs.h +1 −0
  538. drivers/usb/musb/musb_dsps.c +1 −11
  539. drivers/usb/serial/io_ti.h +1 −1
  540. drivers/usb/serial/ti_usb_3410_5052.c +1 −1
  541. drivers/usb/storage/scsiglue.c +9 −0
  542. drivers/usb/storage/uas.c +21 −0
  543. drivers/usb/storage/unusual_devs.h +7 −0
  544. drivers/usb/typec/bus.c +4 −3
  545. drivers/usb/typec/class.c +0 −1
  546. drivers/usb/typec/mux.c +13 −4
  547. drivers/xen/Kconfig +7 −3
  548. drivers/xen/cpu_hotplug.c +8 −7
  549. drivers/xen/events/events_base.c +1 −1
  550. drivers/xen/gntdev.c +15 −11
  551. drivers/xen/grant-table.c +21 −6
  552. drivers/xen/manage.c +4 −2
  553. drivers/xen/mem-reservation.c +4 −0
  554. drivers/xen/xen-balloon.c +3 −0
  555. fs/afs/proc.c +7 −8
  556. fs/ceph/super.c +11 −5
  557. fs/cifs/Kconfig +1 −0
  558. fs/cifs/cifs_unicode.c +0 −3
  559. fs/cifs/cifssmb.c +8 −3
  560. fs/cifs/connect.c +1 −1
  561. fs/cifs/inode.c +2 −0
  562. fs/cifs/misc.c +8 −0
  563. fs/cifs/readdir.c +9 −2
  564. fs/cifs/smb2misc.c +9 −5
  565. fs/cifs/smb2ops.c +25 −10
  566. fs/cifs/smb2pdu.c +20 −12
  567. fs/dax.c +3 −11
  568. fs/ext2/inode.c +1 −1
  569. fs/ext4/dir.c +9 −11
  570. fs/ext4/ext4.h +17 −3
  571. fs/ext4/inline.c +3 −1
  572. fs/ext4/inode.c +11 −9
  573. fs/ext4/mmp.c +0 −1
  574. fs/ext4/namei.c +6 −0
  575. fs/ext4/resize.c +22 −1
  576. fs/ext4/super.c +4 −0
  577. fs/nfs/nfs4proc.c +19 −12
  578. fs/nfs/nfs4state.c +2 −0
  579. fs/nfs/nfs4trace.h +2 −2
  580. fs/nfs/pnfs.c +16 −10
  581. fs/notify/fsnotify.c +3 −10
  582. fs/ocfs2/buffer_head_io.c +1 −0
  583. fs/overlayfs/file.c +20 −3
  584. fs/overlayfs/inode.c +10 −0
  585. fs/overlayfs/super.c +14 −12
  586. fs/proc/kcore.c +1 −0
  587. fs/pstore/ram_core.c +14 −3
  588. fs/ubifs/super.c +6 −1
  589. fs/ubifs/xattr.c +0 −24
  590. include/asm-generic/io.h +2 −1
  591. include/drm/drm_drv.h +1 −1
  592. include/drm/drm_panel.h +0 −1
  593. include/linux/blkdev.h +1 −1
  594. include/linux/compiler-gcc.h +0 −14
  595. include/linux/compiler_types.h +8 −0
  596. include/linux/fs.h +5 −0
  597. include/linux/genhd.h +4 −1
  598. include/linux/hid.h +1 −0
  599. include/linux/kvm_host.h +0 −2
  600. include/linux/mfd/da9063/pdata.h +9 −7
  601. include/linux/mfd/rohm-bd718x7.h +30 −3
  602. include/linux/mlx5/driver.h +4 −4
  603. include/linux/mm_types.h +1 −1
  604. include/linux/mm_types_task.h +1 −1
  605. include/linux/mod_devicetable.h +1 −0
  606. include/linux/netpoll.h +3 −2
  607. include/linux/pci.h +3 −0
  608. include/linux/regulator/machine.h +3 −3
  609. include/linux/spi/spi-mem.h +4 −3
  610. include/linux/stmmac.h +1 −0
  611. include/linux/timekeeping.h +2 −2
  612. include/linux/uio.h +1 −1
  613. include/linux/vga_switcheroo.h +3 −0
  614. include/linux/vm_event_item.h +0 −1
  615. include/linux/vmacache.h +0 −5
  616. include/net/netfilter/nf_conntrack_timeout.h +1 −1
  617. include/net/nfc/hci.h +1 −1
  618. include/net/tls.h +9 −10
  619. include/sound/hdaudio.h +1 −0
  620. include/sound/soc-dapm.h +1 −0
  621. include/uapi/linux/keyctl.h +1 −1
  622. include/uapi/linux/kvm.h +1 −0
  623. include/uapi/linux/perf_event.h +1 −1
  624. include/uapi/sound/skl-tplg-interface.h +54 −52
  625. include/xen/mem-reservation.h +4 −3
  626. kernel/bpf/btf.c +1 −1
  627. kernel/bpf/sockmap.c +71 −20
  628. kernel/bpf/verifier.c +1 −1
  629. kernel/cpu.c +6 −5
  630. kernel/dma/Kconfig +3 −0
  631. kernel/events/core.c +13 −8
  632. kernel/events/hw_breakpoint.c +6 −7
  633. kernel/jump_label.c +1 −1
  634. kernel/locking/lockdep.c +0 −1
  635. kernel/locking/mutex.c +1 −2
  636. kernel/locking/test-ww_mutex.c +1 −1
  637. kernel/pid.c +1 −1
  638. kernel/printk/printk.c +5 −7
  639. kernel/sched/debug.c +4 −2
  640. kernel/sched/fair.c +17 −9
  641. kernel/sched/topology.c +1 −4
  642. kernel/sys.c +0 −3
  643. kernel/time/clocksource.c +30 −10
  644. kernel/trace/ring_buffer.c +2 −0
  645. mm/Kconfig +1 −0
  646. mm/Makefile +1 −2
  647. mm/debug.c +2 −2
  648. mm/fadvise.c +48 −33
  649. mm/readahead.c +17 −28
  650. mm/shmem.c +2 −0
  651. mm/vmacache.c +0 −38
  652. mm/vmscan.c +11 −0
  653. net/batman-adv/bat_v_elp.c +7 −3
  654. net/batman-adv/bridge_loop_avoidance.c +8 −2
  655. net/batman-adv/gateway_client.c +9 −2
  656. net/batman-adv/main.h +1 −1
  657. net/batman-adv/network-coding.c +15 −12
  658. net/batman-adv/soft-interface.c +18 −7
  659. net/batman-adv/sysfs.c +20 −10
  660. net/batman-adv/translation-table.c +4 −2
  661. net/batman-adv/tvlv.c +6 −2
  662. net/bluetooth/smp.c +13 −3
  663. net/core/devlink.c +1 −2
  664. net/core/ethtool.c +1 −0
  665. net/core/filter.c +2 −1
  666. net/core/neighbour.c +8 −5
  667. net/core/netpoll.c +7 −12
  668. net/core/rtnetlink.c +1 −1
  669. net/core/skbuff.c +0 −3
  670. net/ipv4/af_inet.c +1 −0
  671. net/ipv4/ip_fragment.c +1 −0
  672. net/ipv4/ip_gre.c +5 −0
  673. net/ipv4/ip_tunnel.c +9 −0
  674. net/ipv4/netfilter/Kconfig +5 −3
  675. net/ipv4/tcp.c +1 −1
  676. net/ipv4/tcp_input.c +2 −2
  677. net/ipv4/udp.c +26 −23
  678. net/ipv6/addrconf.c +1 −3
  679. net/ipv6/ip6_offload.c +1 −0
  680. net/ipv6/ip6_output.c +2 −4
  681. net/ipv6/ip6_tunnel.c +11 −2
  682. net/ipv6/netfilter/nf_conntrack_reasm.c +1 −0
  683. net/ipv6/route.c +38 −15
  684. net/ipv6/udp.c +37 −28
  685. net/iucv/af_iucv.c +25 −13
  686. net/iucv/iucv.c +1 −1
  687. net/mpls/af_mpls.c +5 −1
  688. net/netfilter/Kconfig +6 −6
  689. net/netfilter/nf_conntrack_proto.c +26 −0
  690. net/netfilter/nf_conntrack_proto_dccp.c +13 −6
  691. net/netfilter/nf_conntrack_proto_generic.c +4 −4
  692. net/netfilter/nf_conntrack_proto_gre.c +4 −4
  693. net/netfilter/nf_conntrack_proto_icmp.c +4 −4
  694. net/netfilter/nf_conntrack_proto_icmpv6.c +4 −4
  695. net/netfilter/nf_conntrack_proto_sctp.c +14 −7
  696. net/netfilter/nf_conntrack_proto_tcp.c +13 −6
  697. net/netfilter/nf_conntrack_proto_udp.c +10 −11
  698. net/netfilter/nf_tables_api.c +1 −0
  699. net/netfilter/nfnetlink_cttimeout.c +3 −3
  700. net/netfilter/nfnetlink_queue.c +1 −0
  701. net/netfilter/nft_ct.c +29 −30
  702. net/netfilter/xt_CHECKSUM.c +21 −1
  703. net/netfilter/xt_cluster.c +13 −1
  704. net/netfilter/xt_hashlimit.c +9 −9
  705. net/netlabel/netlabel_unlabeled.c +2 −1
  706. net/nfc/hci/core.c +10 −0
  707. net/rds/bind.c +4 −1
  708. net/rds/ib.h +1 −1
  709. net/sched/act_sample.c +1 −1
  710. net/sched/act_tunnel_key.c +18 −10
  711. net/sched/cls_api.c +2 −0
  712. net/sctp/transport.c +10 −2
  713. net/smc/af_smc.c +16 −10
  714. net/smc/smc_clc.c +6 −8
  715. net/smc/smc_close.c +7 −7
  716. net/smc/smc_pnet.c +1 −1
  717. net/socket.c +14 −8
  718. net/tipc/netlink_compat.c +5 −0
  719. net/tipc/socket.c +12 −6
  720. net/tipc/socket.h +1 −0
  721. net/tls/tls_device.c +3 −3
  722. net/tls/tls_device_fallback.c +1 −1
  723. net/tls/tls_main.c +16 −6
  724. net/tls/tls_sw.c +19 −8
  725. scripts/depmod.sh +3 −2
  726. scripts/kconfig/Makefile +0 −1
  727. scripts/kconfig/check-pkgconfig.sh +0 −8
  728. scripts/kconfig/gconf-cfg.sh +7 −0
  729. scripts/kconfig/mconf-cfg.sh +14 −11
  730. scripts/kconfig/mconf.c +0 −1
  731. scripts/kconfig/nconf-cfg.sh +14 −11
  732. scripts/kconfig/qconf-cfg.sh +7 −0
  733. scripts/setlocalversion +1 −1
  734. scripts/subarch.include +13 −0
  735. security/Kconfig +1 −1
  736. security/keys/dh.c +1 −1
  737. sound/core/rawmidi.c +2 −2
  738. sound/firewire/bebob/bebob.c +2 −0
  739. sound/firewire/bebob/bebob_maudio.c +14 −14
  740. sound/firewire/digi00x/digi00x.c +1 −0
  741. sound/firewire/fireface/ff-protocol-ff400.c +6 −3
  742. sound/firewire/fireworks/fireworks.c +2 −0
  743. sound/firewire/oxfw/oxfw.c +10 −0
  744. sound/firewire/tascam/tascam.c +1 −0
  745. sound/hda/ext/hdac_ext_stream.c +7 −15
  746. sound/hda/hdac_controller.c +10 −5
  747. sound/pci/emu10k1/emufx.c +1 −1
  748. sound/pci/hda/hda_codec.c +2 −1
  749. sound/pci/hda/hda_intel.c +63 −23
  750. sound/pci/hda/hda_intel.h +1 −0
  751. sound/soc/amd/acp-pcm-dma.c +21 −0
  752. sound/soc/codecs/cs4265.c +2 −2
  753. sound/soc/codecs/max98373.c +3 −0
  754. sound/soc/codecs/rt5514.c +4 −4
  755. sound/soc/codecs/rt5682.c +4 −4
  756. sound/soc/codecs/sigmadsp.c +1 −2
  757. sound/soc/codecs/tas6424.c +9 −3
  758. sound/soc/codecs/wm8804-i2c.c +14 −1
  759. sound/soc/codecs/wm9712.c +1 −1
  760. sound/soc/intel/boards/bytcr_rt5640.c +26 −0
  761. sound/soc/intel/skylake/skl.c +1 −1
  762. sound/soc/qcom/qdsp6/q6routing.c +3 −1
  763. sound/soc/sh/rcar/adg.c +5 −0
  764. sound/soc/sh/rcar/core.c +20 −1
  765. sound/soc/sh/rcar/dma.c +4 −0
  766. sound/soc/sh/rcar/rsnd.h +7 −0
  767. sound/soc/sh/rcar/ssi.c +10 −6
  768. sound/soc/soc-core.c +2 −2
  769. sound/soc/soc-dapm.c +4 −0
  770. tools/arch/arm/include/uapi/asm/kvm.h +13 −0
  771. tools/arch/arm64/include/uapi/asm/kvm.h +13 −0
  772. tools/arch/s390/include/uapi/asm/kvm.h +4 −1
  773. tools/arch/x86/include/uapi/asm/kvm.h +37 −0
  774. tools/hv/hv_kvp_daemon.c +1 −1
  775. tools/include/linux/lockdep.h +3 −0
  776. tools/include/linux/nmi.h +0 −0
  777. tools/include/tools/libc_compat.h +1 −1
  778. tools/include/uapi/asm-generic/unistd.h +3 −1
  779. tools/include/uapi/drm/drm.h +9 −0
  780. tools/include/uapi/linux/if_link.h +17 −0
  781. tools/include/uapi/linux/kvm.h +6 −0
  782. tools/include/uapi/linux/perf_event.h +1 −1
  783. tools/include/uapi/linux/vhost.h +18 −0
  784. tools/kvm/kvm_stat/kvm_stat +49 −10
  785. tools/lib/bpf/Build +1 −1
  786. tools/lib/bpf/libbpf.c +10 −10
  787. tools/lib/bpf/str_error.c +18 −0
  788. tools/lib/bpf/str_error.h +6 −0
  789. tools/perf/Documentation/Makefile +1 −1
  790. tools/perf/Makefile.perf +6 −8
  791. tools/perf/arch/arm64/Makefile +3 −2
  792. tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +3 −3
  793. tools/perf/arch/powerpc/util/sym-handling.c +3 −1
  794. tools/perf/arch/x86/include/arch-tests.h +1 −0
  795. tools/perf/arch/x86/tests/Build +1 −0
  796. tools/perf/arch/x86/tests/arch-tests.c +6 −0
  797. tools/perf/arch/x86/tests/bp-modify.c +213 −0
  798. tools/perf/util/annotate.c +29 −3
  799. tools/perf/util/annotate.h +1 −0
  800. tools/perf/util/evsel.c +3 −2
  801. tools/perf/util/map.c +11 −0
  802. tools/perf/util/trace-event-info.c +1 −1
  803. tools/perf/util/trace-event-parse.c +3 −4
  804. tools/testing/selftests/android/Makefile +1 −1
  805. tools/testing/selftests/android/config +0 −0
  806. tools/testing/selftests/android/ion/Makefile +2 −0
  807. tools/testing/selftests/bpf/test_maps.c +7 −3
  808. tools/testing/selftests/cgroup/.gitignore +1 −0
  809. tools/testing/selftests/cgroup/cgroup_util.c +35 −3
  810. tools/testing/selftests/cgroup/cgroup_util.h +1 −0
  811. tools/testing/selftests/cgroup/test_memcontrol.c +205 −0
  812. tools/testing/selftests/efivarfs/config +1 −0
  813. tools/testing/selftests/futex/functional/Makefile +1 −0
  814. tools/testing/selftests/gpio/Makefile +2 −5
  815. tools/testing/selftests/kselftest.h +0 −1
  816. tools/testing/selftests/kvm/.gitignore +1 −0
  817. tools/testing/selftests/kvm/Makefile +5 −7
  818. tools/testing/selftests/kvm/include/kvm_util.h +4 −0
  819. tools/testing/selftests/kvm/lib/kvm_util.c +89 −0
  820. tools/testing/selftests/kvm/platform_info_test.c +110 −0
  821. tools/testing/selftests/lib.mk +12 −0
  822. tools/testing/selftests/memory-hotplug/config +1 −0
  823. tools/testing/selftests/net/Makefile +1 −0
  824. tools/testing/selftests/net/pmtu.sh +2 −2
  825. tools/testing/selftests/net/tls.c +49 −0
  826. tools/testing/selftests/networking/timestamping/Makefile +1 −0
  827. tools/testing/selftests/powerpc/alignment/Makefile +1 −0
  828. tools/testing/selftests/powerpc/benchmarks/Makefile +1 −0
  829. tools/testing/selftests/powerpc/cache_shape/Makefile +1 −0
  830. tools/testing/selftests/powerpc/copyloops/Makefile +1 −0
  831. tools/testing/selftests/powerpc/dscr/Makefile +1 −0
  832. tools/testing/selftests/powerpc/math/Makefile +1 −0
  833. tools/testing/selftests/powerpc/mm/Makefile +1 −0
  834. tools/testing/selftests/powerpc/pmu/Makefile +1 −0
  835. tools/testing/selftests/powerpc/pmu/ebb/Makefile +1 −0
  836. tools/testing/selftests/powerpc/primitives/Makefile +1 −0
  837. tools/testing/selftests/powerpc/ptrace/Makefile +1 −0
  838. tools/testing/selftests/powerpc/signal/Makefile +1 −0
  839. tools/testing/selftests/powerpc/stringloops/Makefile +1 −0
  840. tools/testing/selftests/powerpc/switch_endian/Makefile +1 −0
  841. tools/testing/selftests/powerpc/syscalls/Makefile +1 −0
  842. tools/testing/selftests/powerpc/tm/Makefile +1 −0
  843. tools/testing/selftests/powerpc/vphn/Makefile +1 −0
  844. tools/testing/selftests/vm/Makefile +0 −4
  845. virt/kvm/arm/mmu.c +8 −13
  846. virt/kvm/arm/trace.h +0 −15
Documentation/ABI/stable/sysfs-devices-system-xen_memory+9−0
@@ -75,3 +75,12 @@ Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> · 74 unmodified lines
7575 Description:
7676 Amount (in KiB) of low (or normal) memory in the
7777 balloon.
78+
79+What: /sys/devices/system/xen_memory/xen_memory0/scrub_pages
80+Date: September 2018
81+KernelVersion: 4.20
82+Contact: xen-devel@lists.xenproject.org
83+Description:
84+ Control scrubbing pages before returning them to Xen for others domains
85+ use. Can be set with xen_scrub_pages cmdline
86+ parameter. Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT.
Documentation/admin-guide/kernel-parameters.txt+12−0
@@ -3523,6 +3523,12 @@ · 3522 unmodified lines
35233523 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes
35243524 See Documentation/blockdev/ramdisk.txt.
35253525
3526+ random.trust_cpu={on,off}
3527+ [KNL] Enable or disable trusting the use of the
3528+ CPU's random number generator (if available) to
3529+ fully seed the kernel's CRNG. Default is controlled
3530+ by CONFIG_RANDOM_TRUST_CPU.
3531+
35263532 ras=option[,option,...] [KNL] RAS-specific options
35273533
35283534 cec_disable [X86]
@@ -4994,6 +5000,12 @@ · 1465 unmodified lines
49945000 Disables the PV optimizations forcing the HVM guest to
49955001 run as generic HVM guest with no PV drivers.
49965002
5003+ xen_scrub_pages= [XEN]
5004+ Boolean option to control scrubbing pages before giving them back
5005+ to Xen, for use by other domains. Can be also changed at runtime
5006+ with /sys/devices/system/xen_memory/xen_memory0/scrub_pages.
5007+ Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT.
5008+
49975009 xirc2ps_cs= [NET,PCMCIA]
49985010 Format:
49995011 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
Documentation/device-mapper/dm-raid.txt+4−0
@@ -348,3 +348,7 @@ Version History · 347 unmodified lines
348348 1.13.1 Fix deadlock caused by early md_stop_writes(). Also fix size an
349349 state races.
350350 1.13.2 Fix raid redundancy validation and avoid keeping raid set frozen
351+1.14.0 Fix reshape race on small devices. Fix stripe adding reshape
352+ deadlock/potential data corruption. Update superblock when
353+ specific devices are requested via rebuild. Fix RAID leg
354+ rebuild errors.
Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.txt+1−2
@@ -3,7 +3,6 @@ · 2 unmodified lines
33 Required properties:
44 - compatible :
55 - "fsl,imx7ulp-lpi2c" for LPI2C compatible with the one integrated on i.MX7ULP soc
6− - "fsl,imx8dv-lpi2c" for LPI2C compatible with the one integrated on i.MX8DV soc
76 - reg : address and length of the lpi2c master registers
87 - interrupts : lpi2c interrupt
98 - clocks : lpi2c clock specifier
@@ -11,7 +10,7 @@ Required properties: · 1 unmodified line
1110 Examples:
1211
1312 lpi2c7: lpi2c7@40a50000 {
14− compatible = "fsl,imx8dv-lpi2c";
13+ compatible = "fsl,imx7ulp-lpi2c";
1514 reg = <0x40A50000 0x10000>;
1615 interrupt-parent = <&intc>;
1716 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
Documentation/devicetree/bindings/input/gpio-keys.txt+1−1
@@ -1,4 +1,4 @@
1−Device-Tree bindings for input/gpio_keys.c keyboard driver
1+Device-Tree bindings for input/keyboard/gpio_keys.c keyboard driver
22
33 Required properties:
44 - compatible = "gpio-keys";
Documentation/devicetree/bindings/net/macb.txt+1−0
@@ -10,6 +10,7 @@ Required properties: · 9 unmodified lines
1010 Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on
1111 the Cadence GEM, or the generic form: "cdns,gem".
1212 Use "atmel,sama5d2-gem" for the GEM IP (10/100) available on Atmel sama5d2 SoCs.
13+ Use "atmel,sama5d3-macb" for the 10/100Mbit IP available on Atmel sama5d3 SoCs.
1314 Use "atmel,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs.
1415 Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs.
1516 Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
Documentation/filesystems/vfs.txt+19−2
@@ -848,7 +848,7 @@ struct file_operations · 847 unmodified lines
848848 ----------------------
849849
850850 This describes how the VFS can manipulate an open file. As of kernel
851−4.1, the following members are defined:
851+4.18, the following members are defined:
852852
853853 struct file_operations {
854854 struct module *owner;
@@ -858,11 +858,11 @@ struct file_operations { · 3 unmodified lines
858858 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
859859 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
860860 int (*iterate) (struct file *, struct dir_context *);
861+ int (*iterate_shared) (struct file *, struct dir_context *);
861862 __poll_t (*poll) (struct file *, struct poll_table_struct *);
862863 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
863864 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
864865 int (*mmap) (struct file *, struct vm_area_struct *);
865− int (*mremap)(struct file *, struct vm_area_struct *);
866866 int (*open) (struct inode *, struct file *);
867867 int (*flush) (struct file *, fl_owner_t id);
868868 int (*release) (struct inode *, struct file *);
@@ -882,6 +882,10 @@ struct file_operations { · 13 unmodified lines
882882 #ifndef CONFIG_MMU
883883 unsigned (*mmap_capabilities)(struct file *);
884884 #endif
885+ ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, loff_t, size_t, unsigned int);
886+ int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t, u64);
887+ int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t, u64);
888+ int (*fadvise)(struct file *, loff_t, loff_t, int);
885889 };
886890
887891 Again, all methods are called without any locks being held, unless
@@ -899,6 +903,9 @@ otherwise noted. · 11 unmodified lines
899903
900904 iterate: called when the VFS needs to read the directory contents
901905
906+ iterate_shared: called when the VFS needs to read the directory contents
907+ when filesystem supports concurrent dir iterators
908+
902909 poll: called by the VFS when a process wants to check if there is
903910 activity on this file and (optionally) go to sleep until there
904911 is activity. Called by the select(2) and poll(2) system calls
@@ -951,6 +958,16 @@ otherwise noted. · 46 unmodified lines
951958
952959 fallocate: called by the VFS to preallocate blocks or punch a hole.
953960
961+ copy_file_range: called by the copy_file_range(2) system call.
962+
963+ clone_file_range: called by the ioctl(2) system call for FICLONERANGE and
964+ FICLONE commands.
965+
966+ dedupe_file_range: called by the ioctl(2) system call for FIDEDUPERANGE
967+ command.
968+
969+ fadvise: possibly called by the fadvise64() system call.
970+
954971 Note that the file operations are implemented by the specific
955972 filesystem in which the inode resides. When opening a device node
956973 (character or block special) most filesystems will call special
Documentation/media/uapi/dvb/video_function_calls.rst+0−1
@@ -33,4 +33,3 @@ Video Function Calls · 32 unmodified lines
3333 video-clear-buffer
3434 video-set-streamtype
3535 video-set-format
36− video-set-attributes
Documentation/process/changes.rst+1−1
@@ -86,7 +86,7 @@ pkg-config · 85 unmodified lines
8686
8787 The build system, as of 4.18, requires pkg-config to check for installed
8888 kconfig tools and to determine flags settings for use in
89−'make {menu,n,g,x}config'. Previously pkg-config was being used but not
89+'make {g,x}config'. Previously pkg-config was being used but not
9090 verified or documented.
9191
9292 Flex
Documentation/process/code-of-conduct.rst+81−0
@@ -0,0 +1,81 @@
1+Contributor Covenant Code of Conduct
2+++++++++++++++++++++++++++++++++++++
3+
4+Our Pledge
5+==========
6+
7+In the interest of fostering an open and welcoming environment, we as
8+contributors and maintainers pledge to making participation in our project and
9+our community a harassment-free experience for everyone, regardless of age, body
10+size, disability, ethnicity, sex characteristics, gender identity and
11+expression, level of experience, education, socio-economic status, nationality,
12+personal appearance, race, religion, or sexual identity and orientation.
13+
14+Our Standards
15+=============
16+
17+Examples of behavior that contributes to creating a positive environment
18+include:
19+
20+* Using welcoming and inclusive language
21+* Being respectful of differing viewpoints and experiences
22+* Gracefully accepting constructive criticism
23+* Focusing on what is best for the community
24+* Showing empathy towards other community members
25+
26+
27+Examples of unacceptable behavior by participants include:
28+
29+* The use of sexualized language or imagery and unwelcome sexual attention or
30+ advances
31+* Trolling, insulting/derogatory comments, and personal or political attacks
32+* Public or private harassment
33+* Publishing others’ private information, such as a physical or electronic
34+ address, without explicit permission
35+* Other conduct which could reasonably be considered inappropriate in a
36+ professional setting
37+
38+
39+Our Responsibilities
40+====================
41+
42+Maintainers are responsible for clarifying the standards of acceptable behavior
43+and are expected to take appropriate and fair corrective action in response to
44+any instances of unacceptable behavior.
45+
46+Maintainers have the right and responsibility to remove, edit, or reject
47+comments, commits, code, wiki edits, issues, and other contributions that are
48+not aligned to this Code of Conduct, or to ban temporarily or permanently any
49+contributor for other behaviors that they deem inappropriate, threatening,
50+offensive, or harmful.
51+
52+Scope
53+=====
54+
55+This Code of Conduct applies both within project spaces and in public spaces
56+when an individual is representing the project or its community. Examples of
57+representing a project or community include using an official project e-mail
58+address, posting via an official social media account, or acting as an appointed
59+representative at an online or offline event. Representation of a project may be
60+further defined and clarified by project maintainers.
61+
62+Enforcement
63+===========
64+
65+Instances of abusive, harassing, or otherwise unacceptable behavior may be
66+reported by contacting the Technical Advisory Board (TAB) at
67+<tab@lists.linux-foundation.org>. All complaints will be reviewed and
68+investigated and will result in a response that is deemed necessary and
69+appropriate to the circumstances. The TAB is obligated to maintain
70+confidentiality with regard to the reporter of an incident. Further details of
71+specific enforcement policies may be posted separately.
72+
73+Maintainers who do not follow or enforce the Code of Conduct in good faith may
74+face temporary or permanent repercussions as determined by other members of the
75+project’s leadership.
76+
77+Attribution
78+===========
79+
80+This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
81+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
Documentation/process/code-of-conflict.rst+0−28
@@ -1,28 +0,0 @@
1−Code of Conflict
2−----------------
3−
4−The Linux kernel development effort is a very personal process compared
5−to "traditional" ways of developing software. Your code and ideas
6−behind it will be carefully reviewed, often resulting in critique and
7−criticism. The review will almost always require improvements to the
8−code before it can be included in the kernel. Know that this happens
9−because everyone involved wants to see the best possible solution for
10−the overall success of Linux. This development process has been proven
11−to create the most robust operating system kernel ever, and we do not
12−want to do anything to cause the quality of submission and eventual
13−result to ever decrease.
14−
15−If however, anyone feels personally abused, threatened, or otherwise
16−uncomfortable due to this process, that is not acceptable. If so,
17−please contact the Linux Foundation's Technical Advisory Board at
18−<tab@lists.linux-foundation.org>, or the individual members, and they
19−will work to resolve the issue to the best of their ability. For more
20−information on who is on the Technical Advisory Board and what their
21−role is, please see:
22−
23− - http://www.linuxfoundation.org/projects/linux/tab
24−
25−As a reviewer of code, please strive to keep things civil and focused on
26−the technical issues involved. We are all humans, and frustrations can
27−be high on both sides of the process. Try to keep in mind the immortal
28−words of Bill and Ted, "Be excellent to each other."
Documentation/process/index.rst+1−1
@@ -20,7 +20,7 @@ Below are the essential guides that every developer should read. · 19 unmodified lines
2020 :maxdepth: 1
2121
2222 howto
23− code-of-conflict
23+ code-of-conduct
2424 development-process
2525 submitting-patches
2626 coding-style
Documentation/virtual/kvm/api.txt+11−1
@@ -4510,7 +4510,8 @@ Do not enable KVM_FEATURE_PV_UNHALT if you disable HLT exits. · 4509 unmodified lines
45104510 Architectures: s390
45114511 Parameters: none
45124512 Returns: 0 on success, -EINVAL if hpage module parameter was not set
4513− or cmma is enabled
4513+ or cmma is enabled, or the VM has the KVM_VM_S390_UCONTROL
4514+ flag set
45144515
45154516 With this capability the KVM support for memory backing with 1m pages
45164517 through hugetlbfs can be enabled for a VM. After the capability is
@@ -4521,6 +4522,15 @@ hpage module parameter is not set to 1, -EINVAL is returned. · 4 unmodified lines
45214522 While it is generally possible to create a huge page backed VM without
45224523 this capability, the VM will not be able to run.
45234524
4525+7.14 KVM_CAP_MSR_PLATFORM_INFO
4526+
4527+Architectures: x86
4528+Parameters: args[0] whether feature should be enabled or not
4529+
4530+With this capability, a guest may read the MSR_PLATFORM_INFO MSR. Otherwise,
4531+a #GP would be raised when the guest tries to access. Currently, this
4532+capability does not enable write permissions of this MSR for the guest.
4533+
45244534 8. Other capabilities.
45254535 ----------------------
45264536
Documentation/x86/earlyprintk.txt+15−10
@@ -35,25 +35,25 @@ and two USB cables, connected like this: · 34 unmodified lines
3535 ( If your system does not list a debug port capability then you probably
3636 won't be able to use the USB debug key. )
3737
38− b.) You also need a Netchip USB debug cable/key:
38+ b.) You also need a NetChip USB debug cable/key:
3939
4040 http://www.plxtech.com/products/NET2000/NET20DC/default.asp
4141
42− This is a small blue plastic connector with two USB connections,
42+ This is a small blue plastic connector with two USB connections;
4343 it draws power from its USB connections.
4444
4545 c.) You need a second client/console system with a high speed USB 2.0
4646 port.
4747
48− d.) The Netchip device must be plugged directly into the physical
48+ d.) The NetChip device must be plugged directly into the physical
4949 debug port on the "host/target" system. You cannot use a USB hub in
5050 between the physical debug port and the "host/target" system.
5151
5252 The EHCI debug controller is bound to a specific physical USB
53− port and the Netchip device will only work as an early printk
53+ port and the NetChip device will only work as an early printk
5454 device in this port. The EHCI host controllers are electrically
5555 wired such that the EHCI debug controller is hooked up to the
56− first physical and there is no way to change this via software.
56+ first physical port and there is no way to change this via software.
5757 You can find the physical port through experimentation by trying
5858 each physical port on the system and rebooting. Or you can try
5959 and use lsusb or look at the kernel info messages emitted by the
@@ -65,9 +65,9 @@ and two USB cables, connected like this: · 5 unmodified lines
6565 to the hardware vendor, because there is no reason not to wire
6666 this port into one of the physically accessible ports.
6767
68− e.) It is also important to note, that many versions of the Netchip
68+ e.) It is also important to note, that many versions of the NetChip
6969 device require the "client/console" system to be plugged into the
70− right and side of the device (with the product logo facing up and
70+ right hand side of the device (with the product logo facing up and
7171 readable left to right). The reason being is that the 5 volt
7272 power supply is taken from only one side of the device and it
7373 must be the side that does not get rebooted.
@@ -81,13 +81,18 @@ and two USB cables, connected like this: · 7 unmodified lines
8181 CONFIG_EARLY_PRINTK_DBGP=y
8282
8383 And you need to add the boot command line: "earlyprintk=dbgp".
84+
8485 (If you are using Grub, append it to the 'kernel' line in
85− /etc/grub.conf)
86+ /etc/grub.conf. If you are using Grub2 on a BIOS firmware system,
87+ append it to the 'linux' line in /boot/grub2/grub.cfg. If you are
88+ using Grub2 on an EFI firmware system, append it to the 'linux'
89+ or 'linuxefi' line in /boot/grub2/grub.cfg or
90+ /boot/efi/EFI/<distro>/grub.cfg.)
8691
8792 On systems with more than one EHCI debug controller you must
8893 specify the correct EHCI debug controller number. The ordering
8994 comes from the PCI bus enumeration of the EHCI controllers. The
90− default with no number argument is "0" the first EHCI debug
95+ default with no number argument is "0" or the first EHCI debug
9196 controller. To use the second EHCI debug controller, you would
9297 use the command line: "earlyprintk=dbgp1"
9398
@@ -111,7 +116,7 @@ and two USB cables, connected like this: · 17 unmodified lines
111116 see the raw output.
112117
113118 c.) On Nvidia Southbridge based systems: the kernel will try to probe
114− and find out which port has debug device connected.
119+ and find out which port has a debug device connected.
115120
116121 3. Testing that it works fine:
117122
MAINTAINERS+48−15
@@ -2311,6 +2311,7 @@ F: drivers/clocksource/cadence_ttc_timer.c · 2310 unmodified lines
23112311 F: drivers/i2c/busses/i2c-cadence.c
23122312 F: drivers/mmc/host/sdhci-of-arasan.c
23132313 F: drivers/edac/synopsys_edac.c
2314+F: drivers/i2c/busses/i2c-xiic.c
23142315
23152316 ARM64 PORT (AARCH64 ARCHITECTURE)
23162317 M: Catalin Marinas <catalin.marinas@arm.com>
@@ -5624,6 +5625,8 @@ F: lib/fault-inject.c · 3307 unmodified lines
56245625
56255626 FBTFT Framebuffer drivers
56265627 M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5628+L: dri-devel@lists.freedesktop.org
5629+L: linux-fbdev@vger.kernel.org
56275630 S: Maintained
56285631 F: drivers/staging/fbtft/
56295632
@@ -6059,7 +6062,7 @@ F: Documentation/gcc-plugins.txt · 429 unmodified lines
60596062
60606063 GASKET DRIVER FRAMEWORK
60616064 M: Rob Springer <rspringer@google.com>
6062−M: John Joseph <jnjoseph@google.com>
6065+M: Todd Poynor <toddpoynor@google.com>
60636066 M: Ben Chan <benchan@chromium.org>
60646067 S: Maintained
60656068 F: drivers/staging/gasket/
@@ -7015,6 +7018,20 @@ F: drivers/crypto/vmx/aes* · 949 unmodified lines
70157018 F: drivers/crypto/vmx/ghash*
70167019 F: drivers/crypto/vmx/ppc-xlate.pl
70177020
7021+IBM Power PCI Hotplug Driver for RPA-compliant PPC64 platform
7022+M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
7023+L: linux-pci@vger.kernel.org
7024+L: linuxppc-dev@lists.ozlabs.org
7025+S: Supported
7026+F: drivers/pci/hotplug/rpaphp*
7027+
7028+IBM Power IO DLPAR Driver for RPA-compliant PPC64 platform
7029+M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
7030+L: linux-pci@vger.kernel.org
7031+L: linuxppc-dev@lists.ozlabs.org
7032+S: Supported
7033+F: drivers/pci/hotplug/rpadlpar*
7034+
70187035 IBM ServeRAID RAID DRIVER
70197036 S: Orphan
70207037 F: drivers/scsi/ips.*
@@ -8299,7 +8316,7 @@ F: include/linux/libata.h · 1278 unmodified lines
82998316 F: Documentation/devicetree/bindings/ata/
83008317
83018318 LIBLOCKDEP
8302−M: Sasha Levin <alexander.levin@verizon.com>
8319+M: Sasha Levin <alexander.levin@microsoft.com>
83038320 S: Maintained
83048321 F: tools/lib/lockdep/
83058322
@@ -9699,13 +9716,6 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/ · 1393 unmodified lines
96999716 S: Maintained
97009717 F: drivers/media/dvb-frontends/mn88473*
97019718
9702−PCI DRIVER FOR MOBIVEIL PCIE IP
9703−M: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
9704−L: linux-pci@vger.kernel.org
9705−S: Supported
9706−F: Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
9707−F: drivers/pci/controller/pcie-mobiveil.c
9708−
97099719 MODULE SUPPORT
97109720 M: Jessica Yu <jeyu@kernel.org>
97119721 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
@@ -10932,7 +10942,7 @@ M: Willy Tarreau <willy@haproxy.com> · 1220 unmodified lines
1093210942 M: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
1093310943 S: Odd Fixes
1093410944 F: Documentation/auxdisplay/lcd-panel-cgram.txt
10935−F: drivers/misc/panel.c
10945+F: drivers/auxdisplay/panel.c
1093610946
1093710947 PARALLEL PORT SUBSYSTEM
1093810948 M: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
@@ -11120,6 +11130,13 @@ F: include/uapi/linux/switchtec_ioctl.h · 181 unmodified lines
1112011130 F: include/linux/switchtec.h
1112111131 F: drivers/ntb/hw/mscc/
1112211132
11133+PCI DRIVER FOR MOBIVEIL PCIE IP
11134+M: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
11135+L: linux-pci@vger.kernel.org
11136+S: Supported
11137+F: Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
11138+F: drivers/pci/controller/pcie-mobiveil.c
11139+
1112311140 PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support)
1112411141 M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
1112511142 M: Jason Cooper <jason@lakedaemon.net>
@@ -11153,7 +11170,7 @@ F: drivers/pci/controller/dwc/pci-exynos.c · 27 unmodified lines
1115311170
1115411171 PCI DRIVER FOR SYNOPSYS DESIGNWARE
1115511172 M: Jingoo Han <jingoohan1@gmail.com>
11156−M: Joao Pinto <Joao.Pinto@synopsys.com>
11173+M: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
1115711174 L: linux-pci@vger.kernel.org
1115811175 S: Maintained
1115911176 F: Documentation/devicetree/bindings/pci/designware-pcie.txt
@@ -11186,8 +11203,14 @@ F: tools/pci/ · 26 unmodified lines
1118611203
1118711204 PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC
1118811205 M: Russell Currey <ruscur@russell.cc>
11206+M: Sam Bobroff <sbobroff@linux.ibm.com>
11207+M: Oliver O'Halloran <oohall@gmail.com>
1118911208 L: linuxppc-dev@lists.ozlabs.org
1119011209 S: Supported
11210+F: Documentation/PCI/pci-error-recovery.txt
11211+F: drivers/pci/pcie/aer.c
11212+F: drivers/pci/pcie/dpc.c
11213+F: drivers/pci/pcie/err.c
1119111214 F: Documentation/powerpc/eeh-pci-error-recovery.txt
1119211215 F: arch/powerpc/kernel/eeh*.c
1119311216 F: arch/powerpc/platforms/*/eeh*.c
@@ -11345,10 +11368,10 @@ S: Maintained · 151 unmodified lines
1134511368 F: drivers/platform/x86/peaq-wmi.c
1134611369
1134711370 PER-CPU MEMORY ALLOCATOR
11371+M: Dennis Zhou <dennis@kernel.org>
1134811372 M: Tejun Heo <tj@kernel.org>
1134911373 M: Christoph Lameter <cl@linux.com>
11350−M: Dennis Zhou <dennisszhou@gmail.com>
11351−T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git
11374+T: git git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu.git
1135211375 S: Maintained
1135311376 F: include/linux/percpu*.h
1135411377 F: mm/percpu*.c
@@ -12243,6 +12266,7 @@ F: Documentation/networking/rds.txt · 888 unmodified lines
1224312266
1224412267 RDT - RESOURCE ALLOCATION
1224512268 M: Fenghua Yu <fenghua.yu@intel.com>
12269+M: Reinette Chatre <reinette.chatre@intel.com>
1224612270 L: linux-kernel@vger.kernel.org
1224712271 S: Supported
1224812272 F: arch/x86/kernel/cpu/intel_rdt*
@@ -13432,9 +13456,8 @@ F: drivers/i2c/busses/i2c-synquacer.c · 1183 unmodified lines
1343213456 F: Documentation/devicetree/bindings/i2c/i2c-synquacer.txt
1343313457
1343413458 SOCIONEXT UNIPHIER SOUND DRIVER
13435−M: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
1343613459 L: alsa-devel@alsa-project.org (moderated for non-subscribers)
13437−S: Maintained
13460+S: Orphan
1343813461 F: sound/soc/uniphier/
1343913462
1344013463 SOEKRIS NET48XX LED SUPPORT
@@ -15896,6 +15919,7 @@ F: net/x25/ · 2455 unmodified lines
1589615919 X86 ARCHITECTURE (32-BIT AND 64-BIT)
1589715920 M: Thomas Gleixner <tglx@linutronix.de>
1589815921 M: Ingo Molnar <mingo@redhat.com>
15922+M: Borislav Petkov <bp@alien8.de>
1589915923 R: "H. Peter Anvin" <hpa@zytor.com>
1590015924 M: x86@kernel.org
1590115925 L: linux-kernel@vger.kernel.org
@@ -15924,6 +15948,15 @@ M: Borislav Petkov <bp@alien8.de> · 22 unmodified lines
1592415948 S: Maintained
1592515949 F: arch/x86/kernel/cpu/microcode/*
1592615950
15951+X86 MM
15952+M: Dave Hansen <dave.hansen@linux.intel.com>
15953+M: Andy Lutomirski <luto@kernel.org>
15954+M: Peter Zijlstra <peterz@infradead.org>
15955+L: linux-kernel@vger.kernel.org
15956+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
15957+S: Maintained
15958+F: arch/x86/mm/
15959+
1592715960 X86 PLATFORM DRIVERS
1592815961 M: Darren Hart <dvhart@infradead.org>
1592915962 M: Andy Shevchenko <andy@infradead.org>
Makefile+7−17
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 4
33 PATCHLEVEL = 19
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc6
66 NAME = Merciless Moray
77
88 # *DOCUMENTATION*
@@ -299,19 +299,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) · 290 unmodified lines
299299 KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
300300 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
301301
302−# SUBARCH tells the usermode build what the underlying arch is. That is set
303−# first, and if a usermode build is happening, the "ARCH=um" on the command
304−# line overrides the setting of ARCH below. If a native build is happening,
305−# then ARCH is assigned, getting whatever value it gets normally, and
306−# SUBARCH is subsequently ignored.
307−
308−SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
309− -e s/sun4u/sparc64/ \
310− -e s/arm.*/arm/ -e s/sa110/arm/ \
311− -e s/s390x/s390/ -e s/parisc64/parisc/ \
312− -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
313− -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
314− -e s/riscv.*/riscv/)
302+include scripts/subarch.include
315303
316304 # Cross compiling and selecting different set of gcc/bin-utils
317305 # ---------------------------------------------------------------------------
@@ -616,6 +604,11 @@ CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \ · 298 unmodified lines
616604 $(call cc-disable-warning,maybe-uninitialized,)
617605 export CFLAGS_GCOV
618606
607+# The arch Makefiles can override CC_FLAGS_FTRACE. We may also append it later.
608+ifdef CONFIG_FUNCTION_TRACER
609+ CC_FLAGS_FTRACE := -pg
610+endif
611+
619612 # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
620613 # values of the respective KBUILD_* variables
621614 ARCH_CPPFLAGS :=
@@ -755,9 +748,6 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ · 133 unmodified lines
755748 endif
756749
757750 ifdef CONFIG_FUNCTION_TRACER
758−ifndef CC_FLAGS_FTRACE
759−CC_FLAGS_FTRACE := -pg
760−endif
761751 ifdef CONFIG_FTRACE_MCOUNT_RECORD
762752 # gcc 5 supports generating the mcount tables directly
763753 ifeq ($(call cc-option-yn,-mrecord-mcount),y)
arch/arc/Kconfig+5−5
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 config ARC
1010 def_bool y
1111 select ARC_TIMERS
12+ select ARCH_HAS_PTE_SPECIAL
1213 select ARCH_HAS_SYNC_DMA_FOR_CPU
1314 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
1415 select ARCH_HAS_SG_CHAIN
@@ -28,8 +29,12 @@ config ARC · 13 unmodified lines
2829 select GENERIC_SMP_IDLE_THREAD
2930 select HAVE_ARCH_KGDB
3031 select HAVE_ARCH_TRACEHOOK
32+ select HAVE_DEBUG_STACKOVERFLOW
3133 select HAVE_FUTEX_CMPXCHG if FUTEX
34+ select HAVE_GENERIC_DMA_COHERENT
3235 select HAVE_IOREMAP_PROT
36+ select HAVE_KERNEL_GZIP
37+ select HAVE_KERNEL_LZMA
3338 select HAVE_KPROBES
3439 select HAVE_KRETPROBES
3540 select HAVE_MEMBLOCK
@@ -44,11 +49,6 @@ config ARC · 8 unmodified lines
4449 select OF_EARLY_FLATTREE
4550 select OF_RESERVED_MEM
4651 select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING
47− select HAVE_DEBUG_STACKOVERFLOW
48− select HAVE_GENERIC_DMA_COHERENT
49− select HAVE_KERNEL_GZIP
50− select HAVE_KERNEL_LZMA
51− select ARCH_HAS_PTE_SPECIAL
5252
5353 config ARCH_HAS_CACHE_LINE_SIZE
5454 def_bool y
arch/arc/Makefile+1−9
@@ -43,10 +43,7 @@ ifdef CONFIG_ARC_CURR_IN_REG · 42 unmodified lines
4343 LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
4444 endif
4545
46−upto_gcc44 := $(call cc-ifversion, -le, 0404, y)
47−atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
48−
49−cflags-$(atleast_gcc44) += -fsection-anchors
46+cflags-y += -fsection-anchors
5047
5148 cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
5249 cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
@@ -82,11 +79,6 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp · 29 unmodified lines
8279 cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
8380 ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
8481
85−# STAR 9000518362: (fixed with binutils shipping with gcc 4.8)
86−# arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
87−# --build-id w/o "-marclinux". Default arc-elf32-ld is OK
88−ldflags-$(upto_gcc44) += -marclinux
89−
9082 LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
9183
9284 # Modules with short calls might break for calls into builtin-kernel
arch/arc/boot/dts/axc003.dtsi+26−0
@@ -93,6 +93,32 @@ · 92 unmodified lines
9393 };
9494 };
9595
96+ /*
97+ * Mark DMA peripherals connected via IOC port as dma-coherent. We do
98+ * it via overlay because peripherals defined in axs10x_mb.dtsi are
99+ * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so
100+ * only AXS103 board has HW-coherent DMA peripherals)
101+ * We don't need to mark pgu@17000 as dma-coherent because it uses
102+ * external DMA buffer located outside of IOC aperture.
103+ */
104+ axs10x_mb {
105+ ethernet@0x18000 {
106+ dma-coherent;
107+ };
108+
109+ ehci@0x40000 {
110+ dma-coherent;
111+ };
112+
113+ ohci@0x60000 {
114+ dma-coherent;
115+ };
116+
117+ mmc@0x15000 {
118+ dma-coherent;
119+ };
120+ };
121+
96122 /*
97123 * The DW APB ICTL intc on MB is connected to CPU intc via a
98124 * DT "invisible" DW APB GPIO block, configured to simply pass thru
arch/arc/boot/dts/axc003_idu.dtsi+26−0
@@ -100,6 +100,32 @@ · 99 unmodified lines
100100 };
101101 };
102102
103+ /*
104+ * Mark DMA peripherals connected via IOC port as dma-coherent. We do
105+ * it via overlay because peripherals defined in axs10x_mb.dtsi are
106+ * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so
107+ * only AXS103 board has HW-coherent DMA peripherals)
108+ * We don't need to mark pgu@17000 as dma-coherent because it uses
109+ * external DMA buffer located outside of IOC aperture.
110+ */
111+ axs10x_mb {
112+ ethernet@0x18000 {
113+ dma-coherent;
114+ };
115+
116+ ehci@0x40000 {
117+ dma-coherent;
118+ };
119+
120+ ohci@0x60000 {
121+ dma-coherent;
122+ };
123+
124+ mmc@0x15000 {
125+ dma-coherent;
126+ };
127+ };
128+
103129 /*
104130 * This INTC is actually connected to DW APB GPIO
105131 * which acts as a wire between MB INTC and CPU INTC.
arch/arc/boot/dts/axs10x_mb.dtsi+6−1
@@ -9,6 +9,10 @@ · 8 unmodified lines
99 */
1010
1111 / {
12+ aliases {
13+ ethernet = &gmac;
14+ };
15+
1216 axs10x_mb {
1317 compatible = "simple-bus";
1418 #address-cells = <1>;
@@ -68,7 +72,7 @@ · 53 unmodified lines
6872 };
6973 };
7074
71− ethernet@0x18000 {
75+ gmac: ethernet@0x18000 {
7276 #interrupt-cells = <1>;
7377 compatible = "snps,dwmac";
7478 reg = < 0x18000 0x2000 >;
@@ -81,6 +85,7 @@ · 6 unmodified lines
8185 max-speed = <100>;
8286 resets = <&creg_rst 5>;
8387 reset-names = "stmmaceth";
88+ mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
8489 };
8590
8691 ehci@0x40000 {
arch/arc/boot/dts/hsdk.dts+10−1
@@ -25,6 +25,10 @@ · 24 unmodified lines
2525 bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1";
2626 };
2727
28+ aliases {
29+ ethernet = &gmac;
30+ };
31+
2832 cpus {
2933 #address-cells = <1>;
3034 #size-cells = <0>;
@@ -163,7 +167,7 @@ · 132 unmodified lines
163167 #clock-cells = <0>;
164168 };
165169
166− ethernet@8000 {
170+ gmac: ethernet@8000 {
167171 #interrupt-cells = <1>;
168172 compatible = "snps,dwmac";
169173 reg = <0x8000 0x2000>;
@@ -176,6 +180,8 @@ · 6 unmodified lines
176180 phy-handle = <&phy0>;
177181 resets = <&cgu_rst HSDK_ETH_RESET>;
178182 reset-names = "stmmaceth";
183+ mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
184+ dma-coherent;
179185
180186 mdio {
181187 #address-cells = <1>;
@@ -194,12 +200,14 @@ · 12 unmodified lines
194200 compatible = "snps,hsdk-v1.0-ohci", "generic-ohci";
195201 reg = <0x60000 0x100>;
196202 interrupts = <15>;
203+ dma-coherent;
197204 };
198205
199206 ehci@40000 {
200207 compatible = "snps,hsdk-v1.0-ehci", "generic-ehci";
201208 reg = <0x40000 0x100>;
202209 interrupts = <15>;
210+ dma-coherent;
203211 };
204212
205213 mmc@a000 {
@@ -212,6 +220,7 @@ · 6 unmodified lines
212220 clock-names = "biu", "ciu";
213221 interrupts = <12>;
214222 bus-width = <4>;
223+ dma-coherent;
215224 };
216225 };
217226
arch/arc/configs/axs101_defconfig+0−3
@@ -1,5 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2−# CONFIG_SWAP is not set
31 CONFIG_SYSVIPC=y
42 CONFIG_POSIX_MQUEUE=y
53 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -63,7 +61,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 57 unmodified lines
6361 CONFIG_MOUSE_SERIAL=y
6462 CONFIG_MOUSE_SYNAPTICS_USB=y
6563 # CONFIG_LEGACY_PTYS is not set
66−# CONFIG_DEVKMEM is not set
6764 CONFIG_SERIAL_8250=y
6865 CONFIG_SERIAL_8250_CONSOLE=y
6966 CONFIG_SERIAL_8250_DW=y
arch/arc/configs/axs103_defconfig+0−3
@@ -1,5 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2−# CONFIG_SWAP is not set
31 CONFIG_SYSVIPC=y
42 CONFIG_POSIX_MQUEUE=y
53 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -64,7 +62,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 58 unmodified lines
6462 CONFIG_MOUSE_SERIAL=y
6563 CONFIG_MOUSE_SYNAPTICS_USB=y
6664 # CONFIG_LEGACY_PTYS is not set
67−# CONFIG_DEVKMEM is not set
6865 CONFIG_SERIAL_8250=y
6966 CONFIG_SERIAL_8250_CONSOLE=y
7067 CONFIG_SERIAL_8250_DW=y
arch/arc/configs/axs103_smp_defconfig+0−3
@@ -1,5 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2−# CONFIG_SWAP is not set
31 CONFIG_SYSVIPC=y
42 CONFIG_POSIX_MQUEUE=y
53 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -65,7 +63,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 59 unmodified lines
6563 CONFIG_MOUSE_SERIAL=y
6664 CONFIG_MOUSE_SYNAPTICS_USB=y
6765 # CONFIG_LEGACY_PTYS is not set
68−# CONFIG_DEVKMEM is not set
6966 CONFIG_SERIAL_8250=y
7067 CONFIG_SERIAL_8250_CONSOLE=y
7168 CONFIG_SERIAL_8250_DW=y
arch/arc/configs/haps_hs_defconfig+0−2
@@ -1,4 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
21 # CONFIG_SWAP is not set
32 CONFIG_SYSVIPC=y
43 CONFIG_POSIX_MQUEUE=y
@@ -57,7 +56,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 52 unmodified lines
5756 # CONFIG_SERIO_SERPORT is not set
5857 CONFIG_SERIO_ARC_PS2=y
5958 # CONFIG_LEGACY_PTYS is not set
60−# CONFIG_DEVKMEM is not set
6159 CONFIG_SERIAL_8250=y
6260 CONFIG_SERIAL_8250_CONSOLE=y
6361 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/haps_hs_smp_defconfig+0−2
@@ -1,4 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
21 # CONFIG_SWAP is not set
32 CONFIG_SYSVIPC=y
43 CONFIG_POSIX_MQUEUE=y
@@ -60,7 +59,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 55 unmodified lines
6059 # CONFIG_SERIO_SERPORT is not set
6160 CONFIG_SERIO_ARC_PS2=y
6261 # CONFIG_LEGACY_PTYS is not set
63−# CONFIG_DEVKMEM is not set
6462 CONFIG_SERIAL_8250=y
6563 CONFIG_SERIAL_8250_CONSOLE=y
6664 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/hsdk_defconfig+0−1
@@ -1,4 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
21 CONFIG_SYSVIPC=y
32 # CONFIG_CROSS_MEMORY_ATTACH is not set
43 CONFIG_NO_HZ_IDLE=y
arch/arc/configs/nps_defconfig+0−1
@@ -59,7 +59,6 @@ CONFIG_NETCONSOLE=y · 58 unmodified lines
5959 # CONFIG_INPUT_MOUSE is not set
6060 # CONFIG_SERIO is not set
6161 # CONFIG_LEGACY_PTYS is not set
62−# CONFIG_DEVKMEM is not set
6362 CONFIG_SERIAL_8250=y
6463 CONFIG_SERIAL_8250_CONSOLE=y
6564 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/nsim_700_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_SWAP is not set
43 CONFIG_SYSVIPC=y
54 CONFIG_POSIX_MQUEUE=y
@@ -44,7 +43,6 @@ CONFIG_LXT_PHY=y · 38 unmodified lines
4443 # CONFIG_INPUT_MOUSE is not set
4544 # CONFIG_SERIO is not set
4645 # CONFIG_LEGACY_PTYS is not set
47−# CONFIG_DEVKMEM is not set
4846 CONFIG_SERIAL_ARC=y
4947 CONFIG_SERIAL_ARC_CONSOLE=y
5048 # CONFIG_HW_RANDOM is not set
arch/arc/configs/nsim_hs_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_SWAP is not set
43 CONFIG_SYSVIPC=y
54 CONFIG_POSIX_MQUEUE=y
@@ -45,7 +44,6 @@ CONFIG_DEVTMPFS=y · 39 unmodified lines
4544 # CONFIG_INPUT_MOUSE is not set
4645 # CONFIG_SERIO is not set
4746 # CONFIG_LEGACY_PTYS is not set
48−# CONFIG_DEVKMEM is not set
4947 CONFIG_SERIAL_ARC=y
5048 CONFIG_SERIAL_ARC_CONSOLE=y
5149 # CONFIG_HW_RANDOM is not set
arch/arc/configs/nsim_hs_smp_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_SWAP is not set
43 # CONFIG_CROSS_MEMORY_ATTACH is not set
54 CONFIG_HIGH_RES_TIMERS=y
@@ -44,7 +43,6 @@ CONFIG_DEVTMPFS=y · 38 unmodified lines
4443 # CONFIG_INPUT_MOUSE is not set
4544 # CONFIG_SERIO is not set
4645 # CONFIG_LEGACY_PTYS is not set
47−# CONFIG_DEVKMEM is not set
4846 CONFIG_SERIAL_ARC=y
4947 CONFIG_SERIAL_ARC_CONSOLE=y
5048 # CONFIG_HW_RANDOM is not set
arch/arc/configs/nsimosci_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_SWAP is not set
43 CONFIG_SYSVIPC=y
54 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -48,7 +47,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 42 unmodified lines
4847 # CONFIG_SERIO_SERPORT is not set
4948 CONFIG_SERIO_ARC_PS2=y
5049 # CONFIG_LEGACY_PTYS is not set
51−# CONFIG_DEVKMEM is not set
5250 CONFIG_SERIAL_8250=y
5351 CONFIG_SERIAL_8250_CONSOLE=y
5452 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/nsimosci_hs_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_SWAP is not set
43 CONFIG_SYSVIPC=y
54 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -47,7 +46,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 41 unmodified lines
4746 # CONFIG_SERIO_SERPORT is not set
4847 CONFIG_SERIO_ARC_PS2=y
4948 # CONFIG_LEGACY_PTYS is not set
50−# CONFIG_DEVKMEM is not set
5149 CONFIG_SERIAL_8250=y
5250 CONFIG_SERIAL_8250_CONSOLE=y
5351 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/nsimosci_hs_smp_defconfig+0−2
@@ -1,4 +1,3 @@
1−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
21 # CONFIG_SWAP is not set
32 CONFIG_SYSVIPC=y
43 # CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -58,7 +57,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y · 53 unmodified lines
5857 # CONFIG_SERIO_SERPORT is not set
5958 CONFIG_SERIO_ARC_PS2=y
6059 # CONFIG_LEGACY_PTYS is not set
61−# CONFIG_DEVKMEM is not set
6260 CONFIG_SERIAL_8250=y
6361 CONFIG_SERIAL_8250_CONSOLE=y
6462 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/tb10x_defconfig+0−1
@@ -57,7 +57,6 @@ CONFIG_STMMAC_ETH=y · 56 unmodified lines
5757 # CONFIG_SERIO is not set
5858 # CONFIG_VT is not set
5959 # CONFIG_LEGACY_PTYS is not set
60−# CONFIG_DEVKMEM is not set
6160 CONFIG_SERIAL_8250=y
6261 CONFIG_SERIAL_8250_CONSOLE=y
6362 CONFIG_SERIAL_8250_NR_UARTS=1
arch/arc/configs/vdk_hs38_defconfig+0−2
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_CROSS_MEMORY_ATTACH is not set
43 CONFIG_HIGH_RES_TIMERS=y
54 CONFIG_IKCONFIG=y
@@ -53,7 +52,6 @@ CONFIG_NATIONAL_PHY=y · 47 unmodified lines
5352 CONFIG_MOUSE_PS2_TOUCHKIT=y
5453 CONFIG_SERIO_ARC_PS2=y
5554 # CONFIG_LEGACY_PTYS is not set
56−# CONFIG_DEVKMEM is not set
5755 CONFIG_SERIAL_8250=y
5856 CONFIG_SERIAL_8250_CONSOLE=y
5957 CONFIG_SERIAL_8250_DW=y
arch/arc/configs/vdk_hs38_smp_defconfig+0−1
@@ -1,5 +1,4 @@
11 # CONFIG_LOCALVERSION_AUTO is not set
2−CONFIG_DEFAULT_HOSTNAME="ARCLinux"
32 # CONFIG_CROSS_MEMORY_ATTACH is not set
43 CONFIG_HIGH_RES_TIMERS=y
54 CONFIG_IKCONFIG=y
arch/arc/include/asm/atomic.h+1−1
@@ -84,7 +84,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ · 83 unmodified lines
8484 "1: llock %[orig], [%[ctr]] \n" \
8585 " " #asm_op " %[val], %[orig], %[i] \n" \
8686 " scond %[val], [%[ctr]] \n" \
87− " \n" \
87+ " bnz 1b \n" \
8888 : [val] "=&r" (val), \
8989 [orig] "=&r" (orig) \
9090 : [ctr] "r" (&v->counter), \
arch/arc/include/asm/dma-mapping.h+13−0
@@ -0,0 +1,13 @@
1+// SPDX-License-Identifier: GPL-2.0
2+// (C) 2018 Synopsys, Inc. (www.synopsys.com)
3+
4+#ifndef ASM_ARC_DMA_MAPPING_H
5+#define ASM_ARC_DMA_MAPPING_H
6+
7+#include <asm-generic/dma-mapping.h>
8+
9+void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
10+ const struct iommu_ops *iommu, bool coherent);
11+#define arch_setup_dma_ops arch_setup_dma_ops
12+
13+#endif
arch/arc/kernel/troubleshoot.c+4−9
@@ -83,9 +83,6 @@ done: · 82 unmodified lines
8383 static void show_faulting_vma(unsigned long address, char *buf)
8484 {
8585 struct vm_area_struct *vma;
86− struct inode *inode;
87− unsigned long ino = 0;
88− dev_t dev = 0;
8986 char *nm = buf;
9087 struct mm_struct *active_mm = current->active_mm;
9188
@@ -99,12 +96,10 @@ static void show_faulting_vma(unsigned long address, char *buf) · 7 unmodified lines
9996 * if the container VMA is not found
10097 */
10198 if (vma && (vma->vm_start <= address)) {
102− struct file *file = vma->vm_file;
103− if (file) {
104− nm = file_path(file, buf, PAGE_SIZE - 1);
105− inode = file_inode(vma->vm_file);
106− dev = inode->i_sb->s_dev;
107− ino = inode->i_ino;
99+ if (vma->vm_file) {
100+ nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1);
101+ if (IS_ERR(nm))
102+ nm = "?";
108103 }
109104 pr_info(" @off 0x%lx in [%s]\n"
110105 " VMA: 0x%08lx to 0x%08lx\n",
arch/arc/mm/cache.c+21−15
@@ -65,7 +65,7 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len) · 64 unmodified lines
6565
6666 n += scnprintf(buf + n, len - n, "Peripherals\t: %#lx%s%s\n",
6767 perip_base,
68− IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency "));
68+ IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency (per-device) "));
6969
7070 return buf;
7171 }
@@ -896,15 +896,6 @@ static void __dma_cache_wback_slc(phys_addr_t start, unsigned long sz) · 824 unmodified lines
896896 slc_op(start, sz, OP_FLUSH);
897897 }
898898
899−/*
900− * DMA ops for systems with IOC
901− * IOC hardware snoops all DMA traffic keeping the caches consistent with
902− * memory - eliding need for any explicit cache maintenance of DMA buffers
903− */
904−static void __dma_cache_wback_inv_ioc(phys_addr_t start, unsigned long sz) {}
905−static void __dma_cache_inv_ioc(phys_addr_t start, unsigned long sz) {}
906−static void __dma_cache_wback_ioc(phys_addr_t start, unsigned long sz) {}
907−
908899 /*
909900 * Exported DMA API
910901 */
@@ -1153,6 +1144,19 @@ noinline void __init arc_ioc_setup(void) · 242 unmodified lines
11531144 {
11541145 unsigned int ioc_base, mem_sz;
11551146
1147+ /*
1148+ * As for today we don't support both IOC and ZONE_HIGHMEM enabled
1149+ * simultaneously. This happens because as of today IOC aperture covers
1150+ * only ZONE_NORMAL (low mem) and any dma transactions outside this
1151+ * region won't be HW coherent.
1152+ * If we want to use both IOC and ZONE_HIGHMEM we can use
1153+ * bounce_buffer to handle dma transactions to HIGHMEM.
1154+ * Also it is possible to modify dma_direct cache ops or increase IOC
1155+ * aperture size if we are planning to use HIGHMEM without PAE.
1156+ */
1157+ if (IS_ENABLED(CONFIG_HIGHMEM))
1158+ panic("IOC and HIGHMEM can't be used simultaneously");
1159+
11561160 /* Flush + invalidate + disable L1 dcache */
11571161 __dc_disable();
11581162
@@ -1264,11 +1268,7 @@ void __init arc_cache_init_master(void) · 105 unmodified lines
12641268 if (is_isa_arcv2() && ioc_enable)
12651269 arc_ioc_setup();
12661270
1267− if (is_isa_arcv2() && ioc_enable) {
1268− __dma_cache_wback_inv = __dma_cache_wback_inv_ioc;
1269− __dma_cache_inv = __dma_cache_inv_ioc;
1270− __dma_cache_wback = __dma_cache_wback_ioc;
1271− } else if (is_isa_arcv2() && l2_line_sz && slc_enable) {
1271+ if (is_isa_arcv2() && l2_line_sz && slc_enable) {
12721272 __dma_cache_wback_inv = __dma_cache_wback_inv_slc;
12731273 __dma_cache_inv = __dma_cache_inv_slc;
12741274 __dma_cache_wback = __dma_cache_wback_slc;
@@ -1277,6 +1277,12 @@ void __init arc_cache_init_master(void) · 2 unmodified lines
12771277 __dma_cache_inv = __dma_cache_inv_l1;
12781278 __dma_cache_wback = __dma_cache_wback_l1;
12791279 }
1280+ /*
1281+ * In case of IOC (say IOC+SLC case), pointers above could still be set
1282+ * but end up not being relevant as the first function in chain is not
1283+ * called at all for @dma_direct_ops
1284+ * arch_sync_dma_for_cpu() -> dma_cache_*() -> __dma_cache_*()
1285+ */
12801286 }
12811287
12821288 void __ref arc_cache_init(void)
arch/arc/mm/dma.c+41−41
@@ -6,20 +6,17 @@ · 5 unmodified lines
66 * published by the Free Software Foundation.
77 */
88
9−/*
10− * DMA Coherent API Notes
11− *
12− * I/O is inherently non-coherent on ARC. So a coherent DMA buffer is
13− * implemented by accessing it using a kernel virtual address, with
14− * Cache bit off in the TLB entry.
15− *
16− * The default DMA address == Phy address which is 0x8000_0000 based.
17− */
18−
199 #include <linux/dma-noncoherent.h>
2010 #include <asm/cache.h>
2111 #include <asm/cacheflush.h>
2212
13+/*
14+ * ARCH specific callbacks for generic noncoherent DMA ops (dma/noncoherent.c)
15+ * - hardware IOC not available (or "dma-coherent" not set for device in DT)
16+ * - But still handle both coherent and non-coherent requests from caller
17+ *
18+ * For DMA coherent hardware (IOC) generic code suffices
19+ */
2320 void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
2421 gfp_t gfp, unsigned long attrs)
2522 {
@@ -27,42 +24,29 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, · 1 unmodified line
2724 struct page *page;
2825 phys_addr_t paddr;
2926 void *kvaddr;
30− int need_coh = 1, need_kvaddr = 0;
31−
32− page = alloc_pages(gfp, order);
33− if (!page)
34− return NULL;
27+ bool need_coh = !(attrs & DMA_ATTR_NON_CONSISTENT);
3528
3629 /*
37− * IOC relies on all data (even coherent DMA data) being in cache
38− * Thus allocate normal cached memory
39− *
40− * The gains with IOC are two pronged:
41− * -For streaming data, elides need for cache maintenance, saving
42− * cycles in flush code, and bus bandwidth as all the lines of a
43− * buffer need to be flushed out to memory
44− * -For coherent data, Read/Write to buffers terminate early in cache
45− * (vs. always going to memory - thus are faster)
30+ * __GFP_HIGHMEM flag is cleared by upper layer functions
31+ * (in include/linux/dma-mapping.h) so we should never get a
32+ * __GFP_HIGHMEM here.
4633 */
47− if ((is_isa_arcv2() && ioc_enable) ||
48− (attrs & DMA_ATTR_NON_CONSISTENT))
49− need_coh = 0;
34+ BUG_ON(gfp & __GFP_HIGHMEM);
5035
51− /*
52− * - A coherent buffer needs MMU mapping to enforce non-cachability
53− * - A highmem page needs a virtual handle (hence MMU mapping)
54− * independent of cachability
55− */
56− if (PageHighMem(page) || need_coh)
57− need_kvaddr = 1;
36+ page = alloc_pages(gfp, order);
37+ if (!page)
38+ return NULL;
5839
5940 /* This is linear addr (0x8000_0000 based) */
6041 paddr = page_to_phys(page);
6142
6243 *dma_handle = paddr;
6344
64− /* This is kernel Virtual address (0x7000_0000 based) */
65− if (need_kvaddr) {
45+ /*
46+ * A coherent buffer needs MMU mapping to enforce non-cachability.
47+ * kvaddr is kernel Virtual address (0x7000_0000 based).
48+ */
49+ if (need_coh) {
6650 kvaddr = ioremap_nocache(paddr, size);
6751 if (kvaddr == NULL) {
6852 __free_pages(page, order);
@@ -93,12 +77,8 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr, · 24 unmodified lines
9377 {
9478 phys_addr_t paddr = dma_handle;
9579 struct page *page = virt_to_page(paddr);
96− int is_non_coh = 1;
97−
98− is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) ||
99− (is_isa_arcv2() && ioc_enable);
10080
101− if (PageHighMem(page) || !is_non_coh)
81+ if (!(attrs & DMA_ATTR_NON_CONSISTENT))
10282 iounmap((void __force __iomem *)vaddr);
10383
10484 __free_pages(page, get_order(size));
@@ -185,3 +165,23 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, · 80 unmodified lines
185165 break;
186166 }
187167 }
168+
169+/*
170+ * Plug in coherent or noncoherent dma ops
171+ */
172+void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
173+ const struct iommu_ops *iommu, bool coherent)
174+{
175+ /*
176+ * IOC hardware snoops all DMA traffic keeping the caches consistent
177+ * with memory - eliding need for any explicit cache maintenance of
178+ * DMA buffers - so we can use dma_direct cache ops.
179+ */
180+ if (is_isa_arcv2() && ioc_enable && coherent) {
181+ set_dma_ops(dev, &dma_direct_ops);
182+ dev_info(dev, "use dma_direct_ops cache ops\n");
183+ } else {
184+ set_dma_ops(dev, &dma_noncoherent_ops);
185+ dev_info(dev, "use dma_noncoherent_ops cache ops\n");
186+ }
187+}
arch/arm/boot/dts/sama5d3_emac.dtsi+1−1
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141 };
4242
4343 macb1: ethernet@f802c000 {
44− compatible = "cdns,at91sam9260-macb", "cdns,macb";
44+ compatible = "atmel,sama5d3-macb", "cdns,at91sam9260-macb", "cdns,macb";
4545 reg = <0xf802c000 0x100>;
4646 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
4747 pinctrl-names = "default";
arch/arm/include/asm/kvm_host.h+0−1
@@ -223,7 +223,6 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, · 222 unmodified lines
223223 struct kvm_vcpu_events *events);
224224
225225 #define KVM_ARCH_WANT_MMU_NOTIFIER
226−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
227226 int kvm_unmap_hva_range(struct kvm *kvm,
228227 unsigned long start, unsigned long end);
229228 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts+2−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646 pinctrl-0 = <&mmc0_pins>;
4747 vmmc-supply = <&reg_cldo1>;
4848 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
49+ bus-width = <4>;
4950 status = "okay";
5051 };
5152
@@ -56,6 +57,7 @@ · 4 unmodified lines
5657 vqmmc-supply = <&reg_bldo2>;
5758 non-removable;
5859 cap-mmc-hw-reset;
60+ bus-width = <8>;
5961 status = "okay";
6062 };
6163
arch/arm64/include/asm/jump_label.h+2−2
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828
2929 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
3030 {
31− asm goto("1: nop\n\t"
31+ asm_volatile_goto("1: nop\n\t"
3232 ".pushsection __jump_table, \"aw\"\n\t"
3333 ".align 3\n\t"
3434 ".quad 1b, %l[l_yes], %c0\n\t"
@@ -42,7 +42,7 @@ l_yes: · 7 unmodified lines
4242
4343 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
4444 {
45− asm goto("1: b %l[l_yes]\n\t"
45+ asm_volatile_goto("1: b %l[l_yes]\n\t"
4646 ".pushsection __jump_table, \"aw\"\n\t"
4747 ".align 3\n\t"
4848 ".quad 1b, %l[l_yes], %c0\n\t"
arch/arm64/include/asm/kvm_host.h+1−3
@@ -61,8 +61,7 @@ struct kvm_arch { · 60 unmodified lines
6161 u64 vmid_gen;
6262 u32 vmid;
6363
64− /* 1-level 2nd stage table and lock */
65− spinlock_t pgd_lock;
64+ /* 1-level 2nd stage table, protected by kvm->mmu_lock */
6665 pgd_t *pgd;
6766
6867 /* VTTBR value associated with above pgd and vmid */
@@ -357,7 +356,6 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, · 288 unmodified lines
357356 struct kvm_vcpu_events *events);
358357
359358 #define KVM_ARCH_WANT_MMU_NOTIFIER
360−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
361359 int kvm_unmap_hva_range(struct kvm *kvm,
362360 unsigned long start, unsigned long end);
363361 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
arch/arm64/kernel/Makefile+1−0
@@ -54,6 +54,7 @@ arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ · 53 unmodified lines
5454 arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o
5555 arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
5656 arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
57+arm64-obj-$(CONFIG_CRASH_CORE) += crash_core.o
5758 arm64-obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o
5859 arm64-obj-$(CONFIG_ARM64_SSBD) += ssbd.o
5960
arch/arm64/kernel/crash_core.c+19−0
@@ -0,0 +1,19 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Copyright (C) Linaro.
4+ * Copyright (C) Huawei Futurewei Technologies.
5+ */
6+
7+#include <linux/crash_core.h>
8+#include <asm/memory.h>
9+
10+void arch_crash_save_vmcoreinfo(void)
11+{
12+ VMCOREINFO_NUMBER(VA_BITS);
13+ /* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
14+ vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
15+ kimage_voffset);
16+ vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
17+ PHYS_OFFSET);
18+ vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
19+}
arch/arm64/kernel/machine_kexec.c+0−11
@@ -358,14 +358,3 @@ void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) · 357 unmodified lines
358358 }
359359 }
360360 #endif /* CONFIG_HIBERNATION */
361−
362−void arch_crash_save_vmcoreinfo(void)
363−{
364− VMCOREINFO_NUMBER(VA_BITS);
365− /* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
366− vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
367− kimage_voffset);
368− vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
369− PHYS_OFFSET);
370− vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
371−}
arch/arm64/kvm/hyp/switch.c+6−3
@@ -98,8 +98,10 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu) · 97 unmodified lines
9898 val = read_sysreg(cpacr_el1);
9999 val |= CPACR_EL1_TTA;
100100 val &= ~CPACR_EL1_ZEN;
101− if (!update_fp_enabled(vcpu))
101+ if (!update_fp_enabled(vcpu)) {
102102 val &= ~CPACR_EL1_FPEN;
103+ __activate_traps_fpsimd32(vcpu);
104+ }
103105
104106 write_sysreg(val, cpacr_el1);
105107
@@ -114,8 +116,10 @@ static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu) · 8 unmodified lines
114116
115117 val = CPTR_EL2_DEFAULT;
116118 val |= CPTR_EL2_TTA | CPTR_EL2_TZ;
117− if (!update_fp_enabled(vcpu))
119+ if (!update_fp_enabled(vcpu)) {
118120 val |= CPTR_EL2_TFP;
121+ __activate_traps_fpsimd32(vcpu);
122+ }
119123
120124 write_sysreg(val, cptr_el2);
121125 }
@@ -129,7 +133,6 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) · 7 unmodified lines
129133 if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE))
130134 write_sysreg_s(vcpu->arch.vsesr_el2, SYS_VSESR_EL2);
131135
132− __activate_traps_fpsimd32(vcpu);
133136 if (has_vhe())
134137 activate_traps_vhe(vcpu);
135138 else
arch/arm64/mm/mmu.c+6−4
@@ -985,8 +985,9 @@ int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) · 984 unmodified lines
985985
986986 pmd = READ_ONCE(*pmdp);
987987
988− /* No-op for empty entry and WARN_ON for valid entry */
989− if (!pmd_present(pmd) || !pmd_table(pmd)) {
988+ if (!pmd_present(pmd))
989+ return 1;
990+ if (!pmd_table(pmd)) {
990991 VM_WARN_ON(!pmd_table(pmd));
991992 return 1;
992993 }
@@ -1007,8 +1008,9 @@ int pud_free_pmd_page(pud_t *pudp, unsigned long addr) · 14 unmodified lines
10071008
10081009 pud = READ_ONCE(*pudp);
10091010
1010− /* No-op for empty entry and WARN_ON for valid entry */
1011− if (!pud_present(pud) || !pud_table(pud)) {
1011+ if (!pud_present(pud))
1012+ return 1;
1013+ if (!pud_table(pud)) {
10121014 VM_WARN_ON(!pud_table(pud));
10131015 return 1;
10141016 }
arch/hexagon/include/asm/bitops.h+2−2
@@ -211,7 +211,7 @@ static inline long ffz(int x) · 210 unmodified lines
211211 * This is defined the same way as ffs.
212212 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
213213 */
214−static inline long fls(int x)
214+static inline int fls(int x)
215215 {
216216 int r;
217217
@@ -232,7 +232,7 @@ static inline long fls(int x) · 14 unmodified lines
232232 * the libc and compiler builtin ffs routines, therefore
233233 * differs in spirit from the above ffz (man ffs).
234234 */
235−static inline long ffs(int x)
235+static inline int ffs(int x)
236236 {
237237 int r;
238238
arch/hexagon/kernel/dma.c+1−1
@@ -60,7 +60,7 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, · 59 unmodified lines
6060 panic("Can't create %s() memory pool!", __func__);
6161 else
6262 gen_pool_add(coherent_pool,
63− pfn_to_virt(max_low_pfn),
63+ (unsigned long)pfn_to_virt(max_low_pfn),
6464 hexagon_coherent_pool_size, -1);
6565 }
6666
arch/m68k/mm/mcfmmu.c+1−1
@@ -172,7 +172,7 @@ void __init cf_bootmem_alloc(void) · 171 unmodified lines
172172 high_memory = (void *)_ramend;
173173
174174 /* Reserve kernel text/data/bss */
175− memblock_reserve(memstart, memstart - _rambase);
175+ memblock_reserve(_rambase, memstart - _rambase);
176176
177177 m68k_virt_to_node_shift = fls(_ramend - 1) - 6;
178178 module_fixup(NULL, __start_fixup, __stop_fixup);
arch/mips/include/asm/kvm_host.h+0−1
@@ -931,7 +931,6 @@ enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu, · 930 unmodified lines
931931 bool write);
932932
933933 #define KVM_ARCH_WANT_MMU_NOTIFIER
934−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
935934 int kvm_unmap_hva_range(struct kvm *kvm,
936935 unsigned long start, unsigned long end);
937936 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
arch/mips/include/asm/mach-lantiq/xway/xway_dma.h+1−0
@@ -40,6 +40,7 @@ struct ltq_dma_channel { · 39 unmodified lines
4040 int desc; /* the current descriptor */
4141 struct ltq_dma_desc *desc_base; /* the descriptor base */
4242 int phys; /* physical addr */
43+ struct device *dev;
4344 };
4445
4546 enum {
arch/mips/kernel/vdso.c+20−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/err.h>
1414 #include <linux/init.h>
1515 #include <linux/ioport.h>
16+#include <linux/kernel.h>
1617 #include <linux/mm.h>
1718 #include <linux/sched.h>
1819 #include <linux/slab.h>
@@ -20,6 +21,7 @@ · 1 unmodified line
2021
2122 #include <asm/abi.h>
2223 #include <asm/mips-cps.h>
24+#include <asm/page.h>
2325 #include <asm/vdso.h>
2426
2527 /* Kernel-provided data used by the VDSO. */
@@ -128,12 +130,30 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · 102 unmodified lines
128130 vvar_size = gic_size + PAGE_SIZE;
129131 size = vvar_size + image->size;
130132
133+ /*
134+ * Find a region that's large enough for us to perform the
135+ * colour-matching alignment below.
136+ */
137+ if (cpu_has_dc_aliases)
138+ size += shm_align_mask + 1;
139+
131140 base = get_unmapped_area(NULL, 0, size, 0, 0);
132141 if (IS_ERR_VALUE(base)) {
133142 ret = base;
134143 goto out;
135144 }
136145
146+ /*
147+ * If we suffer from dcache aliasing, ensure that the VDSO data page
148+ * mapping is coloured the same as the kernel's mapping of that memory.
149+ * This ensures that when the kernel updates the VDSO data userland
150+ * will observe it without requiring cache invalidations.
151+ */
152+ if (cpu_has_dc_aliases) {
153+ base = __ALIGN_MASK(base, shm_align_mask);
154+ base += ((unsigned long)&vdso_data - gic_size) & shm_align_mask;
155+ }
156+
137157 data_addr = base + gic_size;
138158 vdso_addr = data_addr + PAGE_SIZE;
139159
arch/mips/kvm/mmu.c+0−10
@@ -512,16 +512,6 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end, · 511 unmodified lines
512512 return 1;
513513 }
514514
515−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
516−{
517− unsigned long end = hva + PAGE_SIZE;
518−
519− handle_hva_to_gpa(kvm, hva, end, &kvm_unmap_hva_handler, NULL);
520−
521− kvm_mips_callbacks->flush_shadow_all(kvm);
522− return 0;
523−}
524−
525515 int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
526516 {
527517 handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
arch/mips/lantiq/xway/dma.c+2−2
@@ -130,7 +130,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch) · 129 unmodified lines
130130 unsigned long flags;
131131
132132 ch->desc = 0;
133− ch->desc_base = dma_zalloc_coherent(NULL,
133+ ch->desc_base = dma_zalloc_coherent(ch->dev,
134134 LTQ_DESC_NUM * LTQ_DESC_SIZE,
135135 &ch->phys, GFP_ATOMIC);
136136
@@ -182,7 +182,7 @@ ltq_dma_free(struct ltq_dma_channel *ch) · 45 unmodified lines
182182 if (!ch->desc_base)
183183 return;
184184 ltq_dma_close(ch);
185− dma_free_coherent(NULL, LTQ_DESC_NUM * LTQ_DESC_SIZE,
185+ dma_free_coherent(ch->dev, LTQ_DESC_NUM * LTQ_DESC_SIZE,
186186 ch->desc_base, ch->phys);
187187 }
188188 EXPORT_SYMBOL_GPL(ltq_dma_free);
arch/powerpc/include/asm/book3s/64/pgtable.h+0−1
@@ -1051,7 +1051,6 @@ static inline void vmemmap_remove_mapping(unsigned long start, · 1050 unmodified lines
10511051 return hash__vmemmap_remove_mapping(start, page_size);
10521052 }
10531053 #endif
1054−struct page *realmode_pfn_to_page(unsigned long pfn);
10551054
10561055 static inline pte_t pmd_pte(pmd_t pmd)
10571056 {
arch/powerpc/include/asm/iommu.h+0−2
@@ -220,8 +220,6 @@ extern void iommu_del_device(struct device *dev); · 219 unmodified lines
220220 extern int __init tce_iommu_bus_notifier_init(void);
221221 extern long iommu_tce_xchg(struct iommu_table *tbl, unsigned long entry,
222222 unsigned long *hpa, enum dma_data_direction *direction);
223−extern long iommu_tce_xchg_rm(struct iommu_table *tbl, unsigned long entry,
224− unsigned long *hpa, enum dma_data_direction *direction);
225223 #else
226224 static inline void iommu_register_group(struct iommu_table_group *table_group,
227225 int pci_domain_number,
arch/powerpc/include/asm/mmu_context.h+1−0
@@ -38,6 +38,7 @@ extern long mm_iommu_ua_to_hpa(struct mm_iommu_table_group_mem_t *mem, · 37 unmodified lines
3838 unsigned long ua, unsigned int pageshift, unsigned long *hpa);
3939 extern long mm_iommu_ua_to_hpa_rm(struct mm_iommu_table_group_mem_t *mem,
4040 unsigned long ua, unsigned int pageshift, unsigned long *hpa);
41+extern void mm_iommu_ua_mark_dirty_rm(struct mm_struct *mm, unsigned long ua);
4142 extern long mm_iommu_mapped_inc(struct mm_iommu_table_group_mem_t *mem);
4243 extern void mm_iommu_mapped_dec(struct mm_iommu_table_group_mem_t *mem);
4344 #endif
arch/powerpc/include/asm/setup.h+1−0
@@ -9,6 +9,7 @@ extern void ppc_printk_progress(char *s, unsigned short hex); · 8 unmodified lines
99
1010 extern unsigned int rtas_data;
1111 extern unsigned long long memory_limit;
12+extern bool init_mem_is_free;
1213 extern unsigned long klimit;
1314 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
1415
arch/powerpc/kernel/exceptions-64s.S+2−2
@@ -1314,9 +1314,7 @@ EXC_REAL_BEGIN(denorm_exception_hv, 0x1500, 0x100) · 1313 unmodified lines
13141314
13151315 #ifdef CONFIG_PPC_DENORMALISATION
13161316 mfspr r10,SPRN_HSRR1
1317− mfspr r11,SPRN_HSRR0 /* save HSRR0 */
13181317 andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */
1319− addi r11,r11,-4 /* HSRR0 is next instruction */
13201318 bne+ denorm_assist
13211319 #endif
13221320
@@ -1382,6 +1380,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) · 59 unmodified lines
13821380 */
13831381 XVCPSGNDP32(32)
13841382 denorm_done:
1383+ mfspr r11,SPRN_HSRR0
1384+ subi r11,r11,4
13851385 mtspr SPRN_HSRR0,r11
13861386 mtcrf 0x80,r9
13871387 ld r9,PACA_EXGEN+EX_R9(r13)
arch/powerpc/kernel/iommu.c+0−25
@@ -1013,31 +1013,6 @@ long iommu_tce_xchg(struct iommu_table *tbl, unsigned long entry, · 1012 unmodified lines
10131013 }
10141014 EXPORT_SYMBOL_GPL(iommu_tce_xchg);
10151015
1016−#ifdef CONFIG_PPC_BOOK3S_64
1017−long iommu_tce_xchg_rm(struct iommu_table *tbl, unsigned long entry,
1018− unsigned long *hpa, enum dma_data_direction *direction)
1019−{
1020− long ret;
1021−
1022− ret = tbl->it_ops->exchange_rm(tbl, entry, hpa, direction);
1023−
1024− if (!ret && ((*direction == DMA_FROM_DEVICE) ||
1025− (*direction == DMA_BIDIRECTIONAL))) {
1026− struct page *pg = realmode_pfn_to_page(*hpa >> PAGE_SHIFT);
1027−
1028− if (likely(pg)) {
1029− SetPageDirty(pg);
1030− } else {
1031− tbl->it_ops->exchange_rm(tbl, entry, hpa, direction);
1032− ret = -EFAULT;
1033− }
1034− }
1035−
1036− return ret;
1037−}
1038−EXPORT_SYMBOL_GPL(iommu_tce_xchg_rm);
1039−#endif
1040−
10411016 int iommu_take_ownership(struct iommu_table *tbl)
10421017 {
10431018 unsigned long flags, i, sz = (tbl->it_size + 7) >> 3;
arch/powerpc/kernel/tm.S+17−3
@@ -176,13 +176,27 @@ _GLOBAL(tm_reclaim) · 175 unmodified lines
176176 std r1, PACATMSCRATCH(r13)
177177 ld r1, PACAR1(r13)
178178
179− /* Store the PPR in r11 and reset to decent value */
180179 std r11, GPR11(r1) /* Temporary stash */
181180
181+ /*
182+ * Move the saved user r1 to the kernel stack in case PACATMSCRATCH is
183+ * clobbered by an exception once we turn on MSR_RI below.
184+ */
185+ ld r11, PACATMSCRATCH(r13)
186+ std r11, GPR1(r1)
187+
188+ /*
189+ * Store r13 away so we can free up the scratch SPR for the SLB fault
190+ * handler (needed once we start accessing the thread_struct).
191+ */
192+ GET_SCRATCH0(r11)
193+ std r11, GPR13(r1)
194+
182195 /* Reset MSR RI so we can take SLB faults again */
183196 li r11, MSR_RI
184197 mtmsrd r11, 1
185198
199+ /* Store the PPR in r11 and reset to decent value */
186200 mfspr r11, SPRN_PPR
187201 HMT_MEDIUM
188202
@@ -207,11 +221,11 @@ _GLOBAL(tm_reclaim) · 18 unmodified lines
207221 SAVE_GPR(8, r7) /* user r8 */
208222 SAVE_GPR(9, r7) /* user r9 */
209223 SAVE_GPR(10, r7) /* user r10 */
210− ld r3, PACATMSCRATCH(r13) /* user r1 */
224+ ld r3, GPR1(r1) /* user r1 */
211225 ld r4, GPR7(r1) /* user r7 */
212226 ld r5, GPR11(r1) /* user r11 */
213227 ld r6, GPR12(r1) /* user r12 */
214− GET_SCRATCH0(8) /* user r13 */
228+ ld r8, GPR13(r1) /* user r13 */
215229 std r3, GPR1(r7)
216230 std r4, GPR7(r7)
217231 std r5, GPR11(r7)
arch/powerpc/kvm/book3s_64_mmu_hv.c+1−1
@@ -358,7 +358,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, · 357 unmodified lines
358358 unsigned long pp, key;
359359 unsigned long v, orig_v, gr;
360360 __be64 *hptep;
361− int index;
361+ long int index;
362362 int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
363363
364364 if (kvm_is_radix(vcpu->kvm))
arch/powerpc/kvm/book3s_64_mmu_radix.c+40−57
@@ -525,8 +525,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 524 unmodified lines
525525 unsigned long ea, unsigned long dsisr)
526526 {
527527 struct kvm *kvm = vcpu->kvm;
528− unsigned long mmu_seq, pte_size;
529− unsigned long gpa, gfn, hva, pfn;
528+ unsigned long mmu_seq;
529+ unsigned long gpa, gfn, hva;
530530 struct kvm_memory_slot *memslot;
531531 struct page *page = NULL;
532532 long ret;
@@ -623,9 +623,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 90 unmodified lines
623623 */
624624 hva = gfn_to_hva_memslot(memslot, gfn);
625625 if (upgrade_p && __get_user_pages_fast(hva, 1, 1, &page) == 1) {
626− pfn = page_to_pfn(page);
627626 upgrade_write = true;
628627 } else {
628+ unsigned long pfn;
629+
629630 /* Call KVM generic code to do the slow-path check */
630631 pfn = __gfn_to_pfn_memslot(memslot, gfn, false, NULL,
631632 writing, upgrade_p);
@@ -639,63 +640,45 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 7 unmodified lines
639640 }
640641 }
641642
642− /* See if we can insert a 1GB or 2MB large PTE here */
643− level = 0;
644− if (page && PageCompound(page)) {
645− pte_size = PAGE_SIZE << compound_order(compound_head(page));
646− if (pte_size >= PUD_SIZE &&
647− (gpa & (PUD_SIZE - PAGE_SIZE)) ==
648− (hva & (PUD_SIZE - PAGE_SIZE))) {
649− level = 2;
650− pfn &= ~((PUD_SIZE >> PAGE_SHIFT) - 1);
651− } else if (pte_size >= PMD_SIZE &&
652− (gpa & (PMD_SIZE - PAGE_SIZE)) ==
653− (hva & (PMD_SIZE - PAGE_SIZE))) {
654− level = 1;
655− pfn &= ~((PMD_SIZE >> PAGE_SHIFT) - 1);
656− }
657− }
658−
659643 /*
660− * Compute the PTE value that we need to insert.
644+ * Read the PTE from the process' radix tree and use that
645+ * so we get the shift and attribute bits.
661646 */
662− if (page) {
663− pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE |
664− _PAGE_ACCESSED;
665− if (writing || upgrade_write)
666− pgflags |= _PAGE_WRITE | _PAGE_DIRTY;
667− pte = pfn_pte(pfn, __pgprot(pgflags));
647+ local_irq_disable();
648+ ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
649+ pte = *ptep;
650+ local_irq_enable();
651+
652+ /* Get pte level from shift/size */
653+ if (shift == PUD_SHIFT &&
654+ (gpa & (PUD_SIZE - PAGE_SIZE)) ==
655+ (hva & (PUD_SIZE - PAGE_SIZE))) {
656+ level = 2;
657+ } else if (shift == PMD_SHIFT &&
658+ (gpa & (PMD_SIZE - PAGE_SIZE)) ==
659+ (hva & (PMD_SIZE - PAGE_SIZE))) {
660+ level = 1;
668661 } else {
669− /*
670− * Read the PTE from the process' radix tree and use that
671− * so we get the attribute bits.
672− */
673− local_irq_disable();
674− ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
675− pte = *ptep;
676− local_irq_enable();
677− if (shift == PUD_SHIFT &&
678− (gpa & (PUD_SIZE - PAGE_SIZE)) ==
679− (hva & (PUD_SIZE - PAGE_SIZE))) {
680− level = 2;
681− } else if (shift == PMD_SHIFT &&
682− (gpa & (PMD_SIZE - PAGE_SIZE)) ==
683− (hva & (PMD_SIZE - PAGE_SIZE))) {
684− level = 1;
685− } else if (shift && shift != PAGE_SHIFT) {
686− /* Adjust PFN */
687− unsigned long mask = (1ul << shift) - PAGE_SIZE;
688− pte = __pte(pte_val(pte) | (hva & mask));
689− }
690− pte = __pte(pte_val(pte) | _PAGE_EXEC | _PAGE_ACCESSED);
691− if (writing || upgrade_write) {
692− if (pte_val(pte) & _PAGE_WRITE)
693− pte = __pte(pte_val(pte) | _PAGE_DIRTY);
694− } else {
695− pte = __pte(pte_val(pte) & ~(_PAGE_WRITE | _PAGE_DIRTY));
662+ level = 0;
663+ if (shift > PAGE_SHIFT) {
664+ /*
665+ * If the pte maps more than one page, bring over
666+ * bits from the virtual address to get the real
667+ * address of the specific single page we want.
668+ */
669+ unsigned long rpnmask = (1ul << shift) - PAGE_SIZE;
670+ pte = __pte(pte_val(pte) | (hva & rpnmask));
696671 }
697672 }
698673
674+ pte = __pte(pte_val(pte) | _PAGE_EXEC | _PAGE_ACCESSED);
675+ if (writing || upgrade_write) {
676+ if (pte_val(pte) & _PAGE_WRITE)
677+ pte = __pte(pte_val(pte) | _PAGE_DIRTY);
678+ } else {
679+ pte = __pte(pte_val(pte) & ~(_PAGE_WRITE | _PAGE_DIRTY));
680+ }
681+
699682 /* Allocate space in the tree and write the PTE */
700683 ret = kvmppc_create_pte(kvm, pte, gpa, level, mmu_seq);
701684
@@ -725,10 +708,10 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot, · 23 unmodified lines
725708 gpa, shift);
726709 kvmppc_radix_tlbie_page(kvm, gpa, shift);
727710 if ((old & _PAGE_DIRTY) && memslot->dirty_bitmap) {
728− unsigned long npages = 1;
711+ unsigned long psize = PAGE_SIZE;
729712 if (shift)
730− npages = 1ul << (shift - PAGE_SHIFT);
731− kvmppc_update_dirty_map(memslot, gfn, npages);
713+ psize = 1ul << shift;
714+ kvmppc_update_dirty_map(memslot, gfn, psize);
732715 }
733716 }
734717 return 0;
arch/powerpc/kvm/book3s_64_vio_hv.c+31−8
@@ -187,12 +187,35 @@ long kvmppc_gpa_to_ua(struct kvm *kvm, unsigned long gpa, · 186 unmodified lines
187187 EXPORT_SYMBOL_GPL(kvmppc_gpa_to_ua);
188188
189189 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
190−static void kvmppc_rm_clear_tce(struct iommu_table *tbl, unsigned long entry)
190+static long iommu_tce_xchg_rm(struct mm_struct *mm, struct iommu_table *tbl,
191+ unsigned long entry, unsigned long *hpa,
192+ enum dma_data_direction *direction)
193+{
194+ long ret;
195+
196+ ret = tbl->it_ops->exchange_rm(tbl, entry, hpa, direction);
197+
198+ if (!ret && ((*direction == DMA_FROM_DEVICE) ||
199+ (*direction == DMA_BIDIRECTIONAL))) {
200+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY_RM(tbl, entry);
201+ /*
202+ * kvmppc_rm_tce_iommu_do_map() updates the UA cache after
203+ * calling this so we still get here a valid UA.
204+ */
205+ if (pua && *pua)
206+ mm_iommu_ua_mark_dirty_rm(mm, be64_to_cpu(*pua));
207+ }
208+
209+ return ret;
210+}
211+
212+static void kvmppc_rm_clear_tce(struct kvm *kvm, struct iommu_table *tbl,
213+ unsigned long entry)
191214 {
192215 unsigned long hpa = 0;
193216 enum dma_data_direction dir = DMA_NONE;
194217
195− iommu_tce_xchg_rm(tbl, entry, &hpa, &dir);
218+ iommu_tce_xchg_rm(kvm->mm, tbl, entry, &hpa, &dir);
196219 }
197220
198221 static long kvmppc_rm_tce_iommu_mapped_dec(struct kvm *kvm,
@@ -224,7 +247,7 @@ static long kvmppc_rm_tce_iommu_do_unmap(struct kvm *kvm, · 25 unmodified lines
224247 unsigned long hpa = 0;
225248 long ret;
226249
227− if (iommu_tce_xchg_rm(tbl, entry, &hpa, &dir))
250+ if (iommu_tce_xchg_rm(kvm->mm, tbl, entry, &hpa, &dir))
228251 /*
229252 * real mode xchg can fail if struct page crosses
230253 * a page boundary
@@ -236,7 +259,7 @@ static long kvmppc_rm_tce_iommu_do_unmap(struct kvm *kvm, · 5 unmodified lines
236259
237260 ret = kvmppc_rm_tce_iommu_mapped_dec(kvm, tbl, entry);
238261 if (ret)
239− iommu_tce_xchg_rm(tbl, entry, &hpa, &dir);
262+ iommu_tce_xchg_rm(kvm->mm, tbl, entry, &hpa, &dir);
240263
241264 return ret;
242265 }
@@ -282,7 +305,7 @@ static long kvmppc_rm_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl, · 39 unmodified lines
282305 if (WARN_ON_ONCE_RM(mm_iommu_mapped_inc(mem)))
283306 return H_CLOSED;
284307
285− ret = iommu_tce_xchg_rm(tbl, entry, &hpa, &dir);
308+ ret = iommu_tce_xchg_rm(kvm->mm, tbl, entry, &hpa, &dir);
286309 if (ret) {
287310 mm_iommu_mapped_dec(mem);
288311 /*
@@ -371,7 +394,7 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, · 82 unmodified lines
371394 return ret;
372395
373396 WARN_ON_ONCE_RM(1);
374− kvmppc_rm_clear_tce(stit->tbl, entry);
397+ kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, entry);
375398 }
376399
377400 kvmppc_tce_put(stt, entry, tce);
@@ -520,7 +543,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, · 142 unmodified lines
520543 goto unlock_exit;
521544
522545 WARN_ON_ONCE_RM(1);
523− kvmppc_rm_clear_tce(stit->tbl, entry);
546+ kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, entry);
524547 }
525548
526549 kvmppc_tce_put(stt, entry + i, tce);
@@ -571,7 +594,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, · 44 unmodified lines
571594 return ret;
572595
573596 WARN_ON_ONCE_RM(1);
574− kvmppc_rm_clear_tce(stit->tbl, entry);
597+ kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, entry);
575598 }
576599 }
577600
arch/powerpc/lib/checksum_64.S+3−0
@@ -443,6 +443,9 @@ _GLOBAL(csum_ipv6_magic) · 442 unmodified lines
443443 addc r0, r8, r9
444444 ld r10, 0(r4)
445445 ld r11, 8(r4)
446+#ifdef CONFIG_CPU_LITTLE_ENDIAN
447+ rotldi r5, r5, 8
448+#endif
446449 adde r0, r0, r10
447450 add r5, r5, r7
448451 adde r0, r0, r11
arch/powerpc/lib/code-patching.c+6−0
@@ -28,6 +28,12 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr, · 27 unmodified lines
2828 {
2929 int err;
3030
31+ /* Make sure we aren't patching a freed init section */
32+ if (init_mem_is_free && init_section_contains(exec_addr, 4)) {
33+ pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
34+ return 0;
35+ }
36+
3137 __put_user_size(instr, patch_addr, 4, err);
3238 if (err)
3339 return err;
arch/powerpc/mm/init_64.c+0−49
@@ -308,55 +308,6 @@ void register_page_bootmem_memmap(unsigned long section_nr, · 307 unmodified lines
308308 {
309309 }
310310
311−/*
312− * We do not have access to the sparsemem vmemmap, so we fallback to
313− * walking the list of sparsemem blocks which we already maintain for
314− * the sake of crashdump. In the long run, we might want to maintain
315− * a tree if performance of that linear walk becomes a problem.
316− *
317− * realmode_pfn_to_page functions can fail due to:
318− * 1) As real sparsemem blocks do not lay in RAM continously (they
319− * are in virtual address space which is not available in the real mode),
320− * the requested page struct can be split between blocks so get_page/put_page
321− * may fail.
322− * 2) When huge pages are used, the get_page/put_page API will fail
323− * in real mode as the linked addresses in the page struct are virtual
324− * too.
325− */
326−struct page *realmode_pfn_to_page(unsigned long pfn)
327−{
328− struct vmemmap_backing *vmem_back;
329− struct page *page;
330− unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
331− unsigned long pg_va = (unsigned long) pfn_to_page(pfn);
332−
333− for (vmem_back = vmemmap_list; vmem_back; vmem_back = vmem_back->list) {
334− if (pg_va < vmem_back->virt_addr)
335− continue;
336−
337− /* After vmemmap_list entry free is possible, need check all */
338− if ((pg_va + sizeof(struct page)) <=
339− (vmem_back->virt_addr + page_size)) {
340− page = (struct page *) (vmem_back->phys + pg_va -
341− vmem_back->virt_addr);
342− return page;
343− }
344− }
345−
346− /* Probably that page struct is split between real pages */
347− return NULL;
348−}
349−EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
350−
351−#else
352−
353−struct page *realmode_pfn_to_page(unsigned long pfn)
354−{
355− struct page *page = pfn_to_page(pfn);
356− return page;
357−}
358−EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
359−
360311 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
361312
362313 #ifdef CONFIG_PPC_BOOK3S_64
arch/powerpc/mm/mem.c+2−0
@@ -63,6 +63,7 @@ · 62 unmodified lines
6363 #endif
6464
6565 unsigned long long memory_limit;
66+bool init_mem_is_free;
6667
6768 #ifdef CONFIG_HIGHMEM
6869 pte_t *kmap_pte;
@@ -396,6 +397,7 @@ void free_initmem(void) · 327 unmodified lines
396397 {
397398 ppc_md.progress = ppc_printk_progress;
398399 mark_initmem_nx();
400+ init_mem_is_free = true;
399401 free_initmem_default(POISON_FREE_INITMEM);
400402 }
401403
arch/powerpc/mm/mmu_context_iommu.c+30−4
@@ -18,11 +18,15 @@ · 17 unmodified lines
1818 #include <linux/migrate.h>
1919 #include <linux/hugetlb.h>
2020 #include <linux/swap.h>
21+#include <linux/sizes.h>
2122 #include <asm/mmu_context.h>
2223 #include <asm/pte-walk.h>
2324
2425 static DEFINE_MUTEX(mem_list_mutex);
2526
27+#define MM_IOMMU_TABLE_GROUP_PAGE_DIRTY 0x1
28+#define MM_IOMMU_TABLE_GROUP_PAGE_MASK ~(SZ_4K - 1)
29+
2630 struct mm_iommu_table_group_mem_t {
2731 struct list_head next;
2832 struct rcu_head rcu;
@@ -263,6 +267,9 @@ static void mm_iommu_unpin(struct mm_iommu_table_group_mem_t *mem) · 234 unmodified lines
263267 if (!page)
264268 continue;
265269
270+ if (mem->hpas[i] & MM_IOMMU_TABLE_GROUP_PAGE_DIRTY)
271+ SetPageDirty(page);
272+
266273 put_page(page);
267274 mem->hpas[i] = 0;
268275 }
@@ -360,7 +367,6 @@ struct mm_iommu_table_group_mem_t *mm_iommu_lookup_rm(struct mm_struct *mm, · 91 unmodified lines
360367
361368 return ret;
362369 }
363−EXPORT_SYMBOL_GPL(mm_iommu_lookup_rm);
364370
365371 struct mm_iommu_table_group_mem_t *mm_iommu_find(struct mm_struct *mm,
366372 unsigned long ua, unsigned long entries)
@@ -390,7 +396,7 @@ long mm_iommu_ua_to_hpa(struct mm_iommu_table_group_mem_t *mem, · 23 unmodified lines
390396 if (pageshift > mem->pageshift)
391397 return -EFAULT;
392398
393− *hpa = *va | (ua & ~PAGE_MASK);
399+ *hpa = (*va & MM_IOMMU_TABLE_GROUP_PAGE_MASK) | (ua & ~PAGE_MASK);
394400
395401 return 0;
396402 }
@@ -413,11 +419,31 @@ long mm_iommu_ua_to_hpa_rm(struct mm_iommu_table_group_mem_t *mem, · 16 unmodified lines
413419 if (!pa)
414420 return -EFAULT;
415421
416− *hpa = *pa | (ua & ~PAGE_MASK);
422+ *hpa = (*pa & MM_IOMMU_TABLE_GROUP_PAGE_MASK) | (ua & ~PAGE_MASK);
417423
418424 return 0;
419425 }
420−EXPORT_SYMBOL_GPL(mm_iommu_ua_to_hpa_rm);
426+
427+extern void mm_iommu_ua_mark_dirty_rm(struct mm_struct *mm, unsigned long ua)
428+{
429+ struct mm_iommu_table_group_mem_t *mem;
430+ long entry;
431+ void *va;
432+ unsigned long *pa;
433+
434+ mem = mm_iommu_lookup_rm(mm, ua, PAGE_SIZE);
435+ if (!mem)
436+ return;
437+
438+ entry = (ua - mem->ua) >> PAGE_SHIFT;
439+ va = &mem->hpas[entry];
440+
441+ pa = (void *) vmalloc_to_phys(va);
442+ if (!pa)
443+ return;
444+
445+ *pa |= MM_IOMMU_TABLE_GROUP_PAGE_DIRTY;
446+}
421447
422448 long mm_iommu_mapped_inc(struct mm_iommu_table_group_mem_t *mem)
423449 {
arch/powerpc/mm/numa.c+5−2
@@ -1204,7 +1204,9 @@ int find_and_online_cpu_nid(int cpu) · 1203 unmodified lines
12041204 int new_nid;
12051205
12061206 /* Use associativity from first thread for all siblings */
1207− vphn_get_associativity(cpu, associativity);
1207+ if (vphn_get_associativity(cpu, associativity))
1208+ return cpu_to_node(cpu);
1209+
12081210 new_nid = associativity_to_nid(associativity);
12091211 if (new_nid < 0 || !node_possible(new_nid))
12101212 new_nid = first_online_node;
@@ -1452,7 +1454,8 @@ static struct timer_list topology_timer; · 241 unmodified lines
14521454
14531455 static void reset_topology_timer(void)
14541456 {
1455− mod_timer(&topology_timer, jiffies + topology_timer_secs * HZ);
1457+ if (vphn_enabled)
1458+ mod_timer(&topology_timer, jiffies + topology_timer_secs * HZ);
14561459 }
14571460
14581461 #ifdef CONFIG_SMP
arch/powerpc/mm/pkeys.c+1−1
@@ -45,7 +45,7 @@ static void scan_pkey_feature(void) · 44 unmodified lines
4545 * Since any pkey can be used for data or execute, we will just treat
4646 * all keys as equal and track them as one entity.
4747 */
48− pkeys_total = be32_to_cpu(vals[0]);
48+ pkeys_total = vals[0];
4949 pkeys_devtree_defined = true;
5050 }
5151
arch/powerpc/platforms/powernv/pci-ioda-tce.c+1−1
@@ -276,7 +276,7 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 275 unmodified lines
276276 level_shift = entries_shift + 3;
277277 level_shift = max_t(unsigned int, level_shift, PAGE_SHIFT);
278278
279− if ((level_shift - 3) * levels + page_shift >= 60)
279+ if ((level_shift - 3) * levels + page_shift >= 55)
280280 return -EINVAL;
281281
282282 /* Allocate TCE table */
arch/riscv/include/asm/asm-prototypes.h+7−0
@@ -0,0 +1,7 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _ASM_RISCV_PROTOTYPES_H
3+
4+#include <linux/ftrace.h>
5+#include <asm-generic/asm-prototypes.h>
6+
7+#endif /* _ASM_RISCV_PROTOTYPES_H */
arch/riscv/kernel/setup.c+0−7
@@ -85,15 +85,8 @@ atomic_t hart_lottery; · 84 unmodified lines
8585 #ifdef CONFIG_BLK_DEV_INITRD
8686 static void __init setup_initrd(void)
8787 {
88− extern char __initramfs_start[];
89− extern unsigned long __initramfs_size;
9088 unsigned long size;
9189
92− if (__initramfs_size > 0) {
93− initrd_start = (unsigned long)(&__initramfs_start);
94− initrd_end = initrd_start + __initramfs_size;
95− }
96−
9790 if (initrd_start >= initrd_end) {
9891 printk(KERN_INFO "initrd not found or empty");
9992 goto disable;
arch/s390/crypto/paes_s390.c+1−1
@@ -208,7 +208,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier, · 207 unmodified lines
208208 walk->dst.virt.addr, walk->src.virt.addr, n);
209209 if (k)
210210 ret = blkcipher_walk_done(desc, walk, nbytes - k);
211− if (n < k) {
211+ if (k < n) {
212212 if (__cbc_paes_set_key(ctx) != 0)
213213 return blkcipher_walk_done(desc, walk, -EIO);
214214 memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE);
arch/s390/include/asm/mmu.h+7−1
@@ -16,7 +16,13 @@ typedef struct { · 15 unmodified lines
1616 unsigned long asce;
1717 unsigned long asce_limit;
1818 unsigned long vdso_base;
19− /* The mmu context allocates 4K page tables. */
19+ /*
20+ * The following bitfields need a down_write on the mm
21+ * semaphore when they are written to. As they are only
22+ * written once, they can be read without a lock.
23+ *
24+ * The mmu context allocates 4K page tables.
25+ */
2026 unsigned int alloc_pgste:1;
2127 /* The mmu context uses extended page tables. */
2228 unsigned int has_pgste:1;
arch/s390/kvm/kvm-s390.c+4−2
@@ -481,7 +481,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 480 unmodified lines
481481 break;
482482 case KVM_CAP_S390_HPAGE_1M:
483483 r = 0;
484− if (hpage)
484+ if (hpage && !kvm_is_ucontrol(kvm))
485485 r = 1;
486486 break;
487487 case KVM_CAP_S390_MEM_OP:
@@ -691,11 +691,13 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) · 203 unmodified lines
691691 mutex_lock(&kvm->lock);
692692 if (kvm->created_vcpus)
693693 r = -EBUSY;
694− else if (!hpage || kvm->arch.use_cmma)
694+ else if (!hpage || kvm->arch.use_cmma || kvm_is_ucontrol(kvm))
695695 r = -EINVAL;
696696 else {
697697 r = 0;
698+ down_write(&kvm->mm->mmap_sem);
698699 kvm->mm->context.allow_gmap_hpage_1m = 1;
700+ up_write(&kvm->mm->mmap_sem);
699701 /*
700702 * We might have to create fake 4k page
701703 * tables. To avoid that the hardware works on
arch/s390/kvm/priv.c+18−12
@@ -280,9 +280,11 @@ retry: · 279 unmodified lines
280280 goto retry;
281281 }
282282 }
283− if (rc)
284− return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
285283 up_read(&current->mm->mmap_sem);
284+ if (rc == -EFAULT)
285+ return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
286+ if (rc < 0)
287+ return rc;
286288 vcpu->run->s.regs.gprs[reg1] &= ~0xff;
287289 vcpu->run->s.regs.gprs[reg1] |= key;
288290 return 0;
@@ -324,9 +326,11 @@ retry: · 35 unmodified lines
324326 goto retry;
325327 }
326328 }
327− if (rc < 0)
328− return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
329329 up_read(&current->mm->mmap_sem);
330+ if (rc == -EFAULT)
331+ return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
332+ if (rc < 0)
333+ return rc;
330334 kvm_s390_set_psw_cc(vcpu, rc);
331335 return 0;
332336 }
@@ -390,12 +394,12 @@ static int handle_sske(struct kvm_vcpu *vcpu) · 57 unmodified lines
390394 FAULT_FLAG_WRITE, &unlocked);
391395 rc = !rc ? -EAGAIN : rc;
392396 }
397+ up_read(&current->mm->mmap_sem);
393398 if (rc == -EFAULT)
394399 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
395−
396− up_read(&current->mm->mmap_sem);
397− if (rc >= 0)
398− start += PAGE_SIZE;
400+ if (rc < 0)
401+ return rc;
402+ start += PAGE_SIZE;
399403 }
400404
401405 if (m3 & (SSKE_MC | SSKE_MR)) {
@@ -1002,13 +1006,15 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) · 600 unmodified lines
10021006 FAULT_FLAG_WRITE, &unlocked);
10031007 rc = !rc ? -EAGAIN : rc;
10041008 }
1009+ up_read(&current->mm->mmap_sem);
10051010 if (rc == -EFAULT)
10061011 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
1007−
1008− up_read(&current->mm->mmap_sem);
1009− if (rc >= 0)
1010− start += PAGE_SIZE;
1012+ if (rc == -EAGAIN)
1013+ continue;
1014+ if (rc < 0)
1015+ return rc;
10111016 }
1017+ start += PAGE_SIZE;
10121018 }
10131019 if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
10141020 if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) {
arch/s390/kvm/vsie.c+2−1
@@ -173,7 +173,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · 172 unmodified lines
173173 return set_validity_icpt(scb_s, 0x0039U);
174174
175175 /* copy only the wrapping keys */
176− if (read_guest_real(vcpu, crycb_addr + 72, &vsie_page->crycb, 56))
176+ if (read_guest_real(vcpu, crycb_addr + 72,
177+ vsie_page->crycb.dea_wrapping_key_mask, 56))
177178 return set_validity_icpt(scb_s, 0x0035U);
178179
179180 scb_s->ecb3 |= ecb3_flags;
arch/s390/mm/gmap.c+3−1
@@ -708,11 +708,13 @@ void gmap_discard(struct gmap *gmap, unsigned long from, unsigned long to) · 707 unmodified lines
708708 vmaddr |= gaddr & ~PMD_MASK;
709709 /* Find vma in the parent mm */
710710 vma = find_vma(gmap->mm, vmaddr);
711+ if (!vma)
712+ continue;
711713 /*
712714 * We do not discard pages that are backed by
713715 * hugetlbfs, so we don't have to refault them.
714716 */
715− if (vma && is_vm_hugetlb_page(vma))
717+ if (is_vm_hugetlb_page(vma))
716718 continue;
717719 size = min(to - gaddr, PMD_SIZE - (gaddr & ~PMD_MASK));
718720 zap_page_range(vma, vmaddr, size);
arch/x86/boot/compressed/mem_encrypt.S+0−19
@@ -25,20 +25,6 @@ ENTRY(get_sev_encryption_bit) · 24 unmodified lines
2525 push %ebx
2626 push %ecx
2727 push %edx
28− push %edi
29−
30− /*
31− * RIP-relative addressing is needed to access the encryption bit
32− * variable. Since we are running in 32-bit mode we need this call/pop
33− * sequence to get the proper relative addressing.
34− */
35− call 1f
36−1: popl %edi
37− subl $1b, %edi
38−
39− movl enc_bit(%edi), %eax
40− cmpl $0, %eax
41− jge .Lsev_exit
4228
4329 /* Check if running under a hypervisor */
4430 movl $1, %eax
@@ -69,15 +55,12 @@ ENTRY(get_sev_encryption_bit) · 24 unmodified lines
6955
7056 movl %ebx, %eax
7157 andl $0x3f, %eax /* Return the encryption bit location */
72− movl %eax, enc_bit(%edi)
7358 jmp .Lsev_exit
7459
7560 .Lno_sev:
7661 xor %eax, %eax
77− movl %eax, enc_bit(%edi)
7862
7963 .Lsev_exit:
80− pop %edi
8164 pop %edx
8265 pop %ecx
8366 pop %ebx
@@ -113,8 +96,6 @@ ENTRY(set_sev_encryption_mask) · 29 unmodified lines
11396 ENDPROC(set_sev_encryption_mask)
11497
11598 .data
116−enc_bit:
117− .int 0xffffffff
11899
119100 #ifdef CONFIG_AMD_MEM_ENCRYPT
120101 .balign 8
arch/x86/crypto/aegis128-aesni-glue.c+0−1
@@ -379,7 +379,6 @@ static int __init crypto_aegis128_aesni_module_init(void) · 378 unmodified lines
379379 {
380380 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
381381 !boot_cpu_has(X86_FEATURE_AES) ||
382− !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
383382 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
384383 return -ENODEV;
385384
arch/x86/crypto/aegis128l-aesni-glue.c+0−1
@@ -379,7 +379,6 @@ static int __init crypto_aegis128l_aesni_module_init(void) · 378 unmodified lines
379379 {
380380 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
381381 !boot_cpu_has(X86_FEATURE_AES) ||
382− !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
383382 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
384383 return -ENODEV;
385384
arch/x86/crypto/aegis256-aesni-glue.c+0−1
@@ -379,7 +379,6 @@ static int __init crypto_aegis256_aesni_module_init(void) · 378 unmodified lines
379379 {
380380 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
381381 !boot_cpu_has(X86_FEATURE_AES) ||
382− !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
383382 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
384383 return -ENODEV;
385384
arch/x86/crypto/morus1280-sse2-glue.c+0−1
@@ -40,7 +40,6 @@ MORUS1280_DECLARE_ALGS(sse2, "morus1280-sse2", 350); · 39 unmodified lines
4040 static int __init crypto_morus1280_sse2_module_init(void)
4141 {
4242 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
43− !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
4443 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
4544 return -ENODEV;
4645
arch/x86/crypto/morus640-sse2-glue.c+0−1
@@ -40,7 +40,6 @@ MORUS640_DECLARE_ALGS(sse2, "morus640-sse2", 400); · 39 unmodified lines
4040 static int __init crypto_morus640_sse2_module_init(void)
4141 {
4242 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
43− !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
4443 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
4544 return -ENODEV;
4645
arch/x86/events/intel/lbr.c+4−0
@@ -1272,4 +1272,8 @@ void intel_pmu_lbr_init_knl(void) · 1271 unmodified lines
12721272
12731273 x86_pmu.lbr_sel_mask = LBR_SEL_MASK;
12741274 x86_pmu.lbr_sel_map = snb_lbr_sel_map;
1275+
1276+ /* Knights Landing does have MISPREDICT bit */
1277+ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP)
1278+ x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS;
12751279 }
arch/x86/hyperv/hv_apic.c+4−4
@@ -95,8 +95,8 @@ static void hv_apic_eoi_write(u32 reg, u32 val) · 94 unmodified lines
9595 */
9696 static bool __send_ipi_mask_ex(const struct cpumask *mask, int vector)
9797 {
98− struct ipi_arg_ex **arg;
99− struct ipi_arg_ex *ipi_arg;
98+ struct hv_send_ipi_ex **arg;
99+ struct hv_send_ipi_ex *ipi_arg;
100100 unsigned long flags;
101101 int nr_bank = 0;
102102 int ret = 1;
@@ -105,7 +105,7 @@ static bool __send_ipi_mask_ex(const struct cpumask *mask, int vector) · 2 unmodified lines
105105 return false;
106106
107107 local_irq_save(flags);
108− arg = (struct ipi_arg_ex **)this_cpu_ptr(hyperv_pcpu_input_arg);
108+ arg = (struct hv_send_ipi_ex **)this_cpu_ptr(hyperv_pcpu_input_arg);
109109
110110 ipi_arg = *arg;
111111 if (unlikely(!ipi_arg))
@@ -135,7 +135,7 @@ ipi_mask_ex_done: · 23 unmodified lines
135135 static bool __send_ipi_mask(const struct cpumask *mask, int vector)
136136 {
137137 int cur_cpu, vcpu;
138− struct ipi_arg_non_ex ipi_arg;
138+ struct hv_send_ipi ipi_arg;
139139 int ret = 1;
140140
141141 trace_hyperv_send_ipi_mask(mask, vector);
arch/x86/include/asm/atomic.h+6−6
@@ -80,11 +80,11 @@ static __always_inline void arch_atomic_sub(int i, atomic_t *v) · 79 unmodified lines
8080 * true if the result is zero, or false for all
8181 * other cases.
8282 */
83−#define arch_atomic_sub_and_test arch_atomic_sub_and_test
8483 static __always_inline bool arch_atomic_sub_and_test(int i, atomic_t *v)
8584 {
8685 GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, "er", i, "%0", e);
8786 }
87+#define arch_atomic_sub_and_test arch_atomic_sub_and_test
8888
8989 /**
9090 * arch_atomic_inc - increment atomic variable
@@ -92,12 +92,12 @@ static __always_inline bool arch_atomic_sub_and_test(int i, atomic_t *v) · 1 unmodified line
9292 *
9393 * Atomically increments @v by 1.
9494 */
95−#define arch_atomic_inc arch_atomic_inc
9695 static __always_inline void arch_atomic_inc(atomic_t *v)
9796 {
9897 asm volatile(LOCK_PREFIX "incl %0"
9998 : "+m" (v->counter));
10099 }
100+#define arch_atomic_inc arch_atomic_inc
101101
102102 /**
103103 * arch_atomic_dec - decrement atomic variable
@@ -105,12 +105,12 @@ static __always_inline void arch_atomic_inc(atomic_t *v) · 1 unmodified line
105105 *
106106 * Atomically decrements @v by 1.
107107 */
108−#define arch_atomic_dec arch_atomic_dec
109108 static __always_inline void arch_atomic_dec(atomic_t *v)
110109 {
111110 asm volatile(LOCK_PREFIX "decl %0"
112111 : "+m" (v->counter));
113112 }
113+#define arch_atomic_dec arch_atomic_dec
114114
115115 /**
116116 * arch_atomic_dec_and_test - decrement and test
@@ -120,11 +120,11 @@ static __always_inline void arch_atomic_dec(atomic_t *v) · 3 unmodified lines
120120 * returns true if the result is 0, or false for all other
121121 * cases.
122122 */
123−#define arch_atomic_dec_and_test arch_atomic_dec_and_test
124123 static __always_inline bool arch_atomic_dec_and_test(atomic_t *v)
125124 {
126125 GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, "%0", e);
127126 }
127+#define arch_atomic_dec_and_test arch_atomic_dec_and_test
128128
129129 /**
130130 * arch_atomic_inc_and_test - increment and test
@@ -134,11 +134,11 @@ static __always_inline bool arch_atomic_dec_and_test(atomic_t *v) · 3 unmodified lines
134134 * and returns true if the result is zero, or false for all
135135 * other cases.
136136 */
137−#define arch_atomic_inc_and_test arch_atomic_inc_and_test
138137 static __always_inline bool arch_atomic_inc_and_test(atomic_t *v)
139138 {
140139 GEN_UNARY_RMWcc(LOCK_PREFIX "incl", v->counter, "%0", e);
141140 }
141+#define arch_atomic_inc_and_test arch_atomic_inc_and_test
142142
143143 /**
144144 * arch_atomic_add_negative - add and test if negative
@@ -149,11 +149,11 @@ static __always_inline bool arch_atomic_inc_and_test(atomic_t *v) · 4 unmodified lines
149149 * if the result is negative, or false when
150150 * result is greater than or equal to zero.
151151 */
152−#define arch_atomic_add_negative arch_atomic_add_negative
153152 static __always_inline bool arch_atomic_add_negative(int i, atomic_t *v)
154153 {
155154 GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, "er", i, "%0", s);
156155 }
156+#define arch_atomic_add_negative arch_atomic_add_negative
157157
158158 /**
159159 * arch_atomic_add_return - add integer and return
arch/x86/include/asm/atomic64_32.h+4−4
@@ -205,12 +205,12 @@ static inline long long arch_atomic64_sub(long long i, atomic64_t *v) · 204 unmodified lines
205205 *
206206 * Atomically increments @v by 1.
207207 */
208−#define arch_atomic64_inc arch_atomic64_inc
209208 static inline void arch_atomic64_inc(atomic64_t *v)
210209 {
211210 __alternative_atomic64(inc, inc_return, /* no output */,
212211 "S" (v) : "memory", "eax", "ecx", "edx");
213212 }
213+#define arch_atomic64_inc arch_atomic64_inc
214214
215215 /**
216216 * arch_atomic64_dec - decrement atomic64 variable
@@ -218,12 +218,12 @@ static inline void arch_atomic64_inc(atomic64_t *v) · 1 unmodified line
218218 *
219219 * Atomically decrements @v by 1.
220220 */
221−#define arch_atomic64_dec arch_atomic64_dec
222221 static inline void arch_atomic64_dec(atomic64_t *v)
223222 {
224223 __alternative_atomic64(dec, dec_return, /* no output */,
225224 "S" (v) : "memory", "eax", "ecx", "edx");
226225 }
226+#define arch_atomic64_dec arch_atomic64_dec
227227
228228 /**
229229 * arch_atomic64_add_unless - add unless the number is a given value
@@ -245,7 +245,6 @@ static inline int arch_atomic64_add_unless(atomic64_t *v, long long a, · 15 unmodified lines
245245 return (int)a;
246246 }
247247
248−#define arch_atomic64_inc_not_zero arch_atomic64_inc_not_zero
249248 static inline int arch_atomic64_inc_not_zero(atomic64_t *v)
250249 {
251250 int r;
@@ -253,8 +252,8 @@ static inline int arch_atomic64_inc_not_zero(atomic64_t *v) · 1 unmodified line
253252 "S" (v) : "ecx", "edx", "memory");
254253 return r;
255254 }
255+#define arch_atomic64_inc_not_zero arch_atomic64_inc_not_zero
256256
257−#define arch_atomic64_dec_if_positive arch_atomic64_dec_if_positive
258257 static inline long long arch_atomic64_dec_if_positive(atomic64_t *v)
259258 {
260259 long long r;
@@ -262,6 +261,7 @@ static inline long long arch_atomic64_dec_if_positive(atomic64_t *v) · 1 unmodified line
262261 "S" (v) : "ecx", "memory");
263262 return r;
264263 }
264+#define arch_atomic64_dec_if_positive arch_atomic64_dec_if_positive
265265
266266 #undef alternative_atomic64
267267 #undef __alternative_atomic64
arch/x86/include/asm/atomic64_64.h+6−6
@@ -71,11 +71,11 @@ static inline void arch_atomic64_sub(long i, atomic64_t *v) · 70 unmodified lines
7171 * true if the result is zero, or false for all
7272 * other cases.
7373 */
74−#define arch_atomic64_sub_and_test arch_atomic64_sub_and_test
7574 static inline bool arch_atomic64_sub_and_test(long i, atomic64_t *v)
7675 {
7776 GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, "er", i, "%0", e);
7877 }
78+#define arch_atomic64_sub_and_test arch_atomic64_sub_and_test
7979
8080 /**
8181 * arch_atomic64_inc - increment atomic64 variable
@@ -83,13 +83,13 @@ static inline bool arch_atomic64_sub_and_test(long i, atomic64_t *v) · 1 unmodified line
8383 *
8484 * Atomically increments @v by 1.
8585 */
86−#define arch_atomic64_inc arch_atomic64_inc
8786 static __always_inline void arch_atomic64_inc(atomic64_t *v)
8887 {
8988 asm volatile(LOCK_PREFIX "incq %0"
9089 : "=m" (v->counter)
9190 : "m" (v->counter));
9291 }
92+#define arch_atomic64_inc arch_atomic64_inc
9393
9494 /**
9595 * arch_atomic64_dec - decrement atomic64 variable
@@ -97,13 +97,13 @@ static __always_inline void arch_atomic64_inc(atomic64_t *v) · 1 unmodified line
9797 *
9898 * Atomically decrements @v by 1.
9999 */
100−#define arch_atomic64_dec arch_atomic64_dec
101100 static __always_inline void arch_atomic64_dec(atomic64_t *v)
102101 {
103102 asm volatile(LOCK_PREFIX "decq %0"
104103 : "=m" (v->counter)
105104 : "m" (v->counter));
106105 }
106+#define arch_atomic64_dec arch_atomic64_dec
107107
108108 /**
109109 * arch_atomic64_dec_and_test - decrement and test
@@ -113,11 +113,11 @@ static __always_inline void arch_atomic64_dec(atomic64_t *v) · 3 unmodified lines
113113 * returns true if the result is 0, or false for all other
114114 * cases.
115115 */
116−#define arch_atomic64_dec_and_test arch_atomic64_dec_and_test
117116 static inline bool arch_atomic64_dec_and_test(atomic64_t *v)
118117 {
119118 GEN_UNARY_RMWcc(LOCK_PREFIX "decq", v->counter, "%0", e);
120119 }
120+#define arch_atomic64_dec_and_test arch_atomic64_dec_and_test
121121
122122 /**
123123 * arch_atomic64_inc_and_test - increment and test
@@ -127,11 +127,11 @@ static inline bool arch_atomic64_dec_and_test(atomic64_t *v) · 3 unmodified lines
127127 * and returns true if the result is zero, or false for all
128128 * other cases.
129129 */
130−#define arch_atomic64_inc_and_test arch_atomic64_inc_and_test
131130 static inline bool arch_atomic64_inc_and_test(atomic64_t *v)
132131 {
133132 GEN_UNARY_RMWcc(LOCK_PREFIX "incq", v->counter, "%0", e);
134133 }
134+#define arch_atomic64_inc_and_test arch_atomic64_inc_and_test
135135
136136 /**
137137 * arch_atomic64_add_negative - add and test if negative
@@ -142,11 +142,11 @@ static inline bool arch_atomic64_inc_and_test(atomic64_t *v) · 4 unmodified lines
142142 * if the result is negative, or false when
143143 * result is greater than or equal to zero.
144144 */
145−#define arch_atomic64_add_negative arch_atomic64_add_negative
146145 static inline bool arch_atomic64_add_negative(long i, atomic64_t *v)
147146 {
148147 GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, "er", i, "%0", s);
149148 }
149+#define arch_atomic64_add_negative arch_atomic64_add_negative
150150
151151 /**
152152 * arch_atomic64_add_return - add and return
arch/x86/include/asm/fixmap.h+10−0
@@ -14,6 +14,16 @@ · 13 unmodified lines
1414 #ifndef _ASM_X86_FIXMAP_H
1515 #define _ASM_X86_FIXMAP_H
1616
17+/*
18+ * Exposed to assembly code for setting up initial page tables. Cannot be
19+ * calculated in assembly code (fixmap entries are an enum), but is sanity
20+ * checked in the actual fixmap C code to make sure that the fixmap is
21+ * covered fully.
22+ */
23+#define FIXMAP_PMD_NUM 2
24+/* fixmap starts downwards from the 507th entry in level2_fixmap_pgt */
25+#define FIXMAP_PMD_TOP 507
26+
1727 #ifndef __ASSEMBLY__
1828 #include <linux/kernel.h>
1929 #include <asm/acpi.h>
arch/x86/include/asm/hyperv-tlfs.h+9−7
@@ -726,19 +726,21 @@ struct hv_enlightened_vmcs { · 725 unmodified lines
726726 #define HV_STIMER_AUTOENABLE (1ULL << 3)
727727 #define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F)
728728
729−struct ipi_arg_non_ex {
730− u32 vector;
731− u32 reserved;
732− u64 cpu_mask;
733−};
734−
735729 struct hv_vpset {
736730 u64 format;
737731 u64 valid_bank_mask;
738732 u64 bank_contents[];
739733 };
740734
741−struct ipi_arg_ex {
735+/* HvCallSendSyntheticClusterIpi hypercall */
736+struct hv_send_ipi {
737+ u32 vector;
738+ u32 reserved;
739+ u64 cpu_mask;
740+};
741+
742+/* HvCallSendSyntheticClusterIpiEx hypercall */
743+struct hv_send_ipi_ex {
742744 u32 vector;
743745 u32 reserved;
744746 struct hv_vpset vp_set;
arch/x86/include/asm/kdebug.h+11−1
@@ -22,10 +22,20 @@ enum die_val { · 21 unmodified lines
2222 DIE_NMIUNKNOWN,
2323 };
2424
25+enum show_regs_mode {
26+ SHOW_REGS_SHORT,
27+ /*
28+ * For when userspace crashed, but we don't think it's our fault, and
29+ * therefore don't print kernel registers.
30+ */
31+ SHOW_REGS_USER,
32+ SHOW_REGS_ALL
33+};
34+
2535 extern void die(const char *, struct pt_regs *,long);
2636 extern int __must_check __die(const char *, struct pt_regs *, long);
2737 extern void show_stack_regs(struct pt_regs *regs);
28−extern void __show_regs(struct pt_regs *regs, int all);
38+extern void __show_regs(struct pt_regs *regs, enum show_regs_mode);
2939 extern void show_iret_regs(struct pt_regs *regs);
3040 extern unsigned long oops_begin(void);
3141 extern void oops_end(unsigned long, struct pt_regs *, int signr);
arch/x86/include/asm/kvm_host.h+12−15
@@ -869,6 +869,8 @@ struct kvm_arch { · 868 unmodified lines
869869
870870 bool x2apic_format;
871871 bool x2apic_broadcast_quirk_disabled;
872+
873+ bool guest_can_read_msr_platform_info;
872874 };
873875
874876 struct kvm_vm_stat {
@@ -1022,6 +1024,7 @@ struct kvm_x86_ops { · 147 unmodified lines
10221024 void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);
10231025 void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
10241026 void (*hwapic_isr_update)(struct kvm_vcpu *vcpu, int isr);
1027+ bool (*guest_apic_has_interrupt)(struct kvm_vcpu *vcpu);
10251028 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
10261029 void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);
10271030 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa);
@@ -1055,6 +1058,7 @@ struct kvm_x86_ops { · 27 unmodified lines
10551058 bool (*umip_emulated)(void);
10561059
10571060 int (*check_nested_events)(struct kvm_vcpu *vcpu, bool external_intr);
1061+ void (*request_immediate_exit)(struct kvm_vcpu *vcpu);
10581062
10591063 void (*sched_in)(struct kvm_vcpu *kvm, int cpu);
10601064
@@ -1237,19 +1241,12 @@ enum emulation_result { · 176 unmodified lines
12371241 #define EMULTYPE_NO_DECODE (1 << 0)
12381242 #define EMULTYPE_TRAP_UD (1 << 1)
12391243 #define EMULTYPE_SKIP (1 << 2)
1240−#define EMULTYPE_RETRY (1 << 3)
1241−#define EMULTYPE_NO_REEXECUTE (1 << 4)
1242−#define EMULTYPE_NO_UD_ON_FAIL (1 << 5)
1243−#define EMULTYPE_VMWARE (1 << 6)
1244−int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
1245− int emulation_type, void *insn, int insn_len);
1246−
1247−static inline int emulate_instruction(struct kvm_vcpu *vcpu,
1248− int emulation_type)
1249−{
1250− return x86_emulate_instruction(vcpu, 0,
1251− emulation_type | EMULTYPE_NO_REEXECUTE, NULL, 0);
1252−}
1244+#define EMULTYPE_ALLOW_RETRY (1 << 3)
1245+#define EMULTYPE_NO_UD_ON_FAIL (1 << 4)
1246+#define EMULTYPE_VMWARE (1 << 5)
1247+int kvm_emulate_instruction(struct kvm_vcpu *vcpu, int emulation_type);
1248+int kvm_emulate_instruction_from_buffer(struct kvm_vcpu *vcpu,
1249+ void *insn, int insn_len);
12531250
12541251 void kvm_enable_efer_bits(u64);
12551252 bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer);
@@ -1450,7 +1447,6 @@ asmlinkage void kvm_spurious_fault(void); · 194 unmodified lines
14501447 ____kvm_handle_fault_on_reboot(insn, "")
14511448
14521449 #define KVM_ARCH_WANT_MMU_NOTIFIER
1453−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
14541450 int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end);
14551451 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
14561452 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
@@ -1463,7 +1459,7 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); · 6 unmodified lines
14631459 void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);
14641460
14651461 int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low,
1466− unsigned long ipi_bitmap_high, int min,
1462+ unsigned long ipi_bitmap_high, u32 min,
14671463 unsigned long icr, int op_64_bit);
14681464
14691465 u64 kvm_get_arch_capabilities(void);
@@ -1490,6 +1486,7 @@ extern bool kvm_find_async_pf_gfn(struct kvm_vcpu *vcpu, gfn_t gfn); · 20 unmodified lines
14901486
14911487 int kvm_skip_emulated_instruction(struct kvm_vcpu *vcpu);
14921488 int kvm_complete_insn_gp(struct kvm_vcpu *vcpu, int err);
1489+void __kvm_request_immediate_exit(struct kvm_vcpu *vcpu);
14931490
14941491 int kvm_is_in_guest(void);
14951492
arch/x86/include/asm/mem_encrypt.h+7−0
@@ -48,10 +48,13 @@ int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size); · 47 unmodified lines
4848
4949 /* Architecture __weak replacement functions */
5050 void __init mem_encrypt_init(void);
51+void __init mem_encrypt_free_decrypted_mem(void);
5152
5253 bool sme_active(void);
5354 bool sev_active(void);
5455
56+#define __bss_decrypted __attribute__((__section__(".bss..decrypted")))
57+
5558 #else /* !CONFIG_AMD_MEM_ENCRYPT */
5659
5760 #define sme_me_mask 0ULL
@@ -77,6 +80,8 @@ early_set_memory_decrypted(unsigned long vaddr, unsigned long size) { return 0; · 19 unmodified lines
7780 static inline int __init
7881 early_set_memory_encrypted(unsigned long vaddr, unsigned long size) { return 0; }
7982
83+#define __bss_decrypted
84+
8085 #endif /* CONFIG_AMD_MEM_ENCRYPT */
8186
8287 /*
@@ -88,6 +93,8 @@ early_set_memory_encrypted(unsigned long vaddr, unsigned long size) { return 0; · 5 unmodified lines
8893 #define __sme_pa(x) (__pa(x) | sme_me_mask)
8994 #define __sme_pa_nodebug(x) (__pa_nodebug(x) | sme_me_mask)
9095
96+extern char __start_bss_decrypted[], __end_bss_decrypted[], __start_bss_decrypted_unused[];
97+
9198 #endif /* __ASSEMBLY__ */
9299
93100 #endif /* __X86_MEM_ENCRYPT_H__ */
arch/x86/include/asm/pgtable-2level.h+0−9
@@ -19,9 +19,6 @@ static inline void native_set_pte(pte_t *ptep , pte_t pte) · 18 unmodified lines
1919
2020 static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
2121 {
22−#ifdef CONFIG_PAGE_TABLE_ISOLATION
23− pmd.pud.p4d.pgd = pti_set_user_pgtbl(&pmdp->pud.p4d.pgd, pmd.pud.p4d.pgd);
24−#endif
2522 *pmdp = pmd;
2623 }
2724
@@ -61,9 +58,6 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) · 33 unmodified lines
6158 #ifdef CONFIG_SMP
6259 static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
6360 {
64−#ifdef CONFIG_PAGE_TABLE_ISOLATION
65− pti_set_user_pgtbl(&xp->pud.p4d.pgd, __pgd(0));
66−#endif
6761 return __pmd(xchg((pmdval_t *)xp, 0));
6862 }
6963 #else
@@ -73,9 +67,6 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) · 3 unmodified lines
7367 #ifdef CONFIG_SMP
7468 static inline pud_t native_pudp_get_and_clear(pud_t *xp)
7569 {
76−#ifdef CONFIG_PAGE_TABLE_ISOLATION
77− pti_set_user_pgtbl(&xp->p4d.pgd, __pgd(0));
78−#endif
7970 return __pud(xchg((pudval_t *)xp, 0));
8071 }
8172 #else
arch/x86/include/asm/pgtable.h+1−1
@@ -1195,7 +1195,7 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma, · 1194 unmodified lines
11951195 return xchg(pmdp, pmd);
11961196 } else {
11971197 pmd_t old = *pmdp;
1198− *pmdp = pmd;
1198+ WRITE_ONCE(*pmdp, pmd);
11991199 return old;
12001200 }
12011201 }
arch/x86/include/asm/pgtable_64.h+12−11
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <asm/processor.h>
1515 #include <linux/bitops.h>
1616 #include <linux/threads.h>
17+#include <asm/fixmap.h>
1718
1819 extern p4d_t level4_kernel_pgt[512];
1920 extern p4d_t level4_ident_pgt[512];
@@ -22,7 +23,7 @@ extern pud_t level3_ident_pgt[512]; · 2 unmodified lines
2223 extern pmd_t level2_kernel_pgt[512];
2324 extern pmd_t level2_fixmap_pgt[512];
2425 extern pmd_t level2_ident_pgt[512];
25−extern pte_t level1_fixmap_pgt[512];
26+extern pte_t level1_fixmap_pgt[512 * FIXMAP_PMD_NUM];
2627 extern pgd_t init_top_pgt[];
2728
2829 #define swapper_pg_dir init_top_pgt
@@ -55,15 +56,15 @@ struct mm_struct; · 26 unmodified lines
5556 void set_pte_vaddr_p4d(p4d_t *p4d_page, unsigned long vaddr, pte_t new_pte);
5657 void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
5758
58−static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
59− pte_t *ptep)
59+static inline void native_set_pte(pte_t *ptep, pte_t pte)
6060 {
61− *ptep = native_make_pte(0);
61+ WRITE_ONCE(*ptep, pte);
6262 }
6363
64−static inline void native_set_pte(pte_t *ptep, pte_t pte)
64+static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
65+ pte_t *ptep)
6566 {
66− *ptep = pte;
67+ native_set_pte(ptep, native_make_pte(0));
6768 }
6869
6970 static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -73,7 +74,7 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) · 3 unmodified lines
7374
7475 static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
7576 {
76− *pmdp = pmd;
77+ WRITE_ONCE(*pmdp, pmd);
7778 }
7879
7980 static inline void native_pmd_clear(pmd_t *pmd)
@@ -109,7 +110,7 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) · 29 unmodified lines
109110
110111 static inline void native_set_pud(pud_t *pudp, pud_t pud)
111112 {
112− *pudp = pud;
113+ WRITE_ONCE(*pudp, pud);
113114 }
114115
115116 static inline void native_pud_clear(pud_t *pud)
@@ -137,13 +138,13 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d) · 21 unmodified lines
137138 pgd_t pgd;
138139
139140 if (pgtable_l5_enabled() || !IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) {
140− *p4dp = p4d;
141+ WRITE_ONCE(*p4dp, p4d);
141142 return;
142143 }
143144
144145 pgd = native_make_pgd(native_p4d_val(p4d));
145146 pgd = pti_set_user_pgtbl((pgd_t *)p4dp, pgd);
146− *p4dp = native_make_p4d(native_pgd_val(pgd));
147+ WRITE_ONCE(*p4dp, native_make_p4d(native_pgd_val(pgd)));
147148 }
148149
149150 static inline void native_p4d_clear(p4d_t *p4d)
@@ -153,7 +154,7 @@ static inline void native_p4d_clear(p4d_t *p4d) · 3 unmodified lines
153154
154155 static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
155156 {
156− *pgdp = pti_set_user_pgtbl(pgdp, pgd);
157+ WRITE_ONCE(*pgdp, pti_set_user_pgtbl(pgdp, pgd));
157158 }
158159
159160 static inline void native_pgd_clear(pgd_t *pgd)
arch/x86/include/uapi/asm/kvm.h+1−0
@@ -377,6 +377,7 @@ struct kvm_sync_regs { · 376 unmodified lines
377377
378378 #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
379379 #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
380+#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
380381
381382 #define KVM_STATE_NESTED_GUEST_MODE 0x00000001
382383 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002
arch/x86/kernel/apic/vector.c+1−1
@@ -413,7 +413,7 @@ static int activate_managed(struct irq_data *irqd) · 412 unmodified lines
413413 if (WARN_ON_ONCE(cpumask_empty(vector_searchmask))) {
414414 /* Something in the core code broke! Survive gracefully */
415415 pr_err("Managed startup for irq %u, but no CPU\n", irqd->irq);
416− return EINVAL;
416+ return -EINVAL;
417417 }
418418
419419 ret = assign_managed_vector(irqd, vector_searchmask);
arch/x86/kernel/apm_32.c+2−0
@@ -1640,6 +1640,7 @@ static int do_open(struct inode *inode, struct file *filp) · 1639 unmodified lines
16401640 return 0;
16411641 }
16421642
1643+#ifdef CONFIG_PROC_FS
16431644 static int proc_apm_show(struct seq_file *m, void *v)
16441645 {
16451646 unsigned short bx;
@@ -1719,6 +1720,7 @@ static int proc_apm_show(struct seq_file *m, void *v) · 73 unmodified lines
17191720 units);
17201721 return 0;
17211722 }
1723+#endif
17221724
17231725 static int apm(void *unused)
17241726 {
arch/x86/kernel/cpu/intel_rdt.h+13−4
@@ -382,6 +382,11 @@ static inline bool is_mbm_event(int e) · 381 unmodified lines
382382 e <= QOS_L3_MBM_LOCAL_EVENT_ID);
383383 }
384384
385+struct rdt_parse_data {
386+ struct rdtgroup *rdtgrp;
387+ char *buf;
388+};
389+
385390 /**
386391 * struct rdt_resource - attributes of an RDT resource
387392 * @rid: The index of the resource
@@ -423,16 +428,19 @@ struct rdt_resource { · 35 unmodified lines
423428 struct rdt_cache cache;
424429 struct rdt_membw membw;
425430 const char *format_str;
426− int (*parse_ctrlval) (void *data, struct rdt_resource *r,
427− struct rdt_domain *d);
431+ int (*parse_ctrlval)(struct rdt_parse_data *data,
432+ struct rdt_resource *r,
433+ struct rdt_domain *d);
428434 struct list_head evt_list;
429435 int num_rmid;
430436 unsigned int mon_scale;
431437 unsigned long fflags;
432438 };
433439
434−int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d);
435−int parse_bw(void *_buf, struct rdt_resource *r, struct rdt_domain *d);
440+int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
441+ struct rdt_domain *d);
442+int parse_bw(struct rdt_parse_data *data, struct rdt_resource *r,
443+ struct rdt_domain *d);
436444
437445 extern struct mutex rdtgroup_mutex;
438446
@@ -536,6 +544,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp); · 97 unmodified lines
536544 void rdtgroup_pseudo_lock_remove(struct rdtgroup *rdtgrp);
537545 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
538546 int update_domains(struct rdt_resource *r, int closid);
547+int closids_supported(void);
539548 void closid_free(int closid);
540549 int alloc_rmid(void);
541550 void free_rmid(u32 rmid);
arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c+14−13
@@ -64,19 +64,19 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r) · 63 unmodified lines
6464 return true;
6565 }
6666
67−int parse_bw(void *_buf, struct rdt_resource *r, struct rdt_domain *d)
67+int parse_bw(struct rdt_parse_data *data, struct rdt_resource *r,
68+ struct rdt_domain *d)
6869 {
69− unsigned long data;
70− char *buf = _buf;
70+ unsigned long bw_val;
7171
7272 if (d->have_new_ctrl) {
7373 rdt_last_cmd_printf("duplicate domain %d\n", d->id);
7474 return -EINVAL;
7575 }
7676
77− if (!bw_validate(buf, &data, r))
77+ if (!bw_validate(data->buf, &bw_val, r))
7878 return -EINVAL;
79− d->new_ctrl = data;
79+ d->new_ctrl = bw_val;
8080 d->have_new_ctrl = true;
8181
8282 return 0;
@@ -123,18 +123,13 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r) · 40 unmodified lines
123123 return true;
124124 }
125125
126−struct rdt_cbm_parse_data {
127− struct rdtgroup *rdtgrp;
128− char *buf;
129−};
130−
131126 /*
132127 * Read one cache bit mask (hex). Check that it is valid for the current
133128 * resource type.
134129 */
135−int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d)
130+int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
131+ struct rdt_domain *d)
136132 {
137− struct rdt_cbm_parse_data *data = _data;
138133 struct rdtgroup *rdtgrp = data->rdtgrp;
139134 u32 cbm_val;
140135
@@ -195,11 +190,17 @@ int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d) · 54 unmodified lines
195190 static int parse_line(char *line, struct rdt_resource *r,
196191 struct rdtgroup *rdtgrp)
197192 {
198− struct rdt_cbm_parse_data data;
193+ struct rdt_parse_data data;
199194 char *dom = NULL, *id;
200195 struct rdt_domain *d;
201196 unsigned long dom_id;
202197
198+ if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP &&
199+ r->rid == RDT_RESOURCE_MBA) {
200+ rdt_last_cmd_puts("Cannot pseudo-lock MBA resource\n");
201+ return -EINVAL;
202+ }
203+
203204 next:
204205 if (!line || line[0] == '\0')
205206 return 0;
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c+44−9
@@ -97,6 +97,12 @@ void rdt_last_cmd_printf(const char *fmt, ...) · 96 unmodified lines
9797 * limited as the number of resources grows.
9898 */
9999 static int closid_free_map;
100+static int closid_free_map_len;
101+
102+int closids_supported(void)
103+{
104+ return closid_free_map_len;
105+}
100106
101107 static void closid_init(void)
102108 {
@@ -111,6 +117,7 @@ static void closid_init(void) · 8 unmodified lines
111117
112118 /* CLOSID 0 is always reserved for the default group */
113119 closid_free_map &= ~1;
120+ closid_free_map_len = rdt_min_closid;
114121 }
115122
116123 static int closid_alloc(void)
@@ -802,7 +809,7 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of, · 685 unmodified lines
802809 sw_shareable = 0;
803810 exclusive = 0;
804811 seq_printf(seq, "%d=", dom->id);
805− for (i = 0; i < r->num_closid; i++, ctrl++) {
812+ for (i = 0; i < closids_supported(); i++, ctrl++) {
806813 if (!closid_allocated(i))
807814 continue;
808815 mode = rdtgroup_mode_by_closid(i);
@@ -989,7 +996,7 @@ bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d, · 180 unmodified lines
989996
990997 /* Check for overlap with other resource groups */
991998 ctrl = d->ctrl_val;
992− for (i = 0; i < r->num_closid; i++, ctrl++) {
999+ for (i = 0; i < closids_supported(); i++, ctrl++) {
9931000 ctrl_b = (unsigned long *)ctrl;
9941001 mode = rdtgroup_mode_by_closid(i);
9951002 if (closid_allocated(i) && i != closid &&
@@ -1024,16 +1031,27 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) · 28 unmodified lines
10241031 {
10251032 int closid = rdtgrp->closid;
10261033 struct rdt_resource *r;
1034+ bool has_cache = false;
10271035 struct rdt_domain *d;
10281036
10291037 for_each_alloc_enabled_rdt_resource(r) {
1038+ if (r->rid == RDT_RESOURCE_MBA)
1039+ continue;
1040+ has_cache = true;
10301041 list_for_each_entry(d, &r->domains, list) {
10311042 if (rdtgroup_cbm_overlaps(r, d, d->ctrl_val[closid],
1032− rdtgrp->closid, false))
1043+ rdtgrp->closid, false)) {
1044+ rdt_last_cmd_puts("schemata overlaps\n");
10331045 return false;
1046+ }
10341047 }
10351048 }
10361049
1050+ if (!has_cache) {
1051+ rdt_last_cmd_puts("cannot be exclusive without CAT/CDP\n");
1052+ return false;
1053+ }
1054+
10371055 return true;
10381056 }
10391057
@@ -1085,7 +1103,6 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of, · 45 unmodified lines
10851103 rdtgrp->mode = RDT_MODE_SHAREABLE;
10861104 } else if (!strcmp(buf, "exclusive")) {
10871105 if (!rdtgroup_mode_test_exclusive(rdtgrp)) {
1088− rdt_last_cmd_printf("schemata overlaps\n");
10891106 ret = -EINVAL;
10901107 goto out;
10911108 }
@@ -1155,8 +1172,8 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, · 63 unmodified lines
11551172 struct rdt_resource *r;
11561173 struct rdt_domain *d;
11571174 unsigned int size;
1158− bool sep = false;
1159− u32 cbm;
1175+ bool sep;
1176+ u32 ctrl;
11601177
11611178 rdtgrp = rdtgroup_kn_lock_live(of->kn);
11621179 if (!rdtgrp) {
@@ -1174,6 +1191,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, · 11 unmodified lines
11741191 }
11751192
11761193 for_each_alloc_enabled_rdt_resource(r) {
1194+ sep = false;
11771195 seq_printf(s, "%*s:", max_name_width, r->name);
11781196 list_for_each_entry(d, &r->domains, list) {
11791197 if (sep)
@@ -1181,8 +1199,13 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, · 1 unmodified line
11811199 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
11821200 size = 0;
11831201 } else {
1184− cbm = d->ctrl_val[rdtgrp->closid];
1185− size = rdtgroup_cbm_to_size(r, d, cbm);
1202+ ctrl = (!is_mba_sc(r) ?
1203+ d->ctrl_val[rdtgrp->closid] :
1204+ d->mbps_val[rdtgrp->closid]);
1205+ if (r->rid == RDT_RESOURCE_MBA)
1206+ size = ctrl;
1207+ else
1208+ size = rdtgroup_cbm_to_size(r, d, ctrl);
11861209 }
11871210 seq_printf(s, "%d=%u", d->id, size);
11881211 sep = true;
@@ -2336,12 +2359,18 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) · 1147 unmodified lines
23362359 u32 *ctrl;
23372360
23382361 for_each_alloc_enabled_rdt_resource(r) {
2362+ /*
2363+ * Only initialize default allocations for CBM cache
2364+ * resources
2365+ */
2366+ if (r->rid == RDT_RESOURCE_MBA)
2367+ continue;
23392368 list_for_each_entry(d, &r->domains, list) {
23402369 d->have_new_ctrl = false;
23412370 d->new_ctrl = r->cache.shareable_bits;
23422371 used_b = r->cache.shareable_bits;
23432372 ctrl = d->ctrl_val;
2344− for (i = 0; i < r->num_closid; i++, ctrl++) {
2373+ for (i = 0; i < closids_supported(); i++, ctrl++) {
23452374 if (closid_allocated(i) && i != closid) {
23462375 mode = rdtgroup_mode_by_closid(i);
23472376 if (mode == RDT_MODE_PSEUDO_LOCKSETUP)
@@ -2373,6 +2402,12 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) · 25 unmodified lines
23732402 }
23742403
23752404 for_each_alloc_enabled_rdt_resource(r) {
2405+ /*
2406+ * Only initialize default allocations for CBM cache
2407+ * resources
2408+ */
2409+ if (r->rid == RDT_RESOURCE_MBA)
2410+ continue;
23762411 ret = update_domains(r, rdtgrp->closid);
23772412 if (ret < 0) {
23782413 rdt_last_cmd_puts("failed to initialize allocations\n");
arch/x86/kernel/cpu/microcode/amd.c+16−8
@@ -504,6 +504,7 @@ static enum ucode_state apply_microcode_amd(int cpu) · 503 unmodified lines
504504 struct microcode_amd *mc_amd;
505505 struct ucode_cpu_info *uci;
506506 struct ucode_patch *p;
507+ enum ucode_state ret;
507508 u32 rev, dummy;
508509
509510 BUG_ON(raw_smp_processor_id() != cpu);
@@ -521,9 +522,8 @@ static enum ucode_state apply_microcode_amd(int cpu) · 11 unmodified lines
521522
522523 /* need to apply patch? */
523524 if (rev >= mc_amd->hdr.patch_id) {
524− c->microcode = rev;
525− uci->cpu_sig.rev = rev;
526− return UCODE_OK;
525+ ret = UCODE_OK;
526+ goto out;
527527 }
528528
529529 if (__apply_microcode_amd(mc_amd)) {
@@ -531,13 +531,21 @@ static enum ucode_state apply_microcode_amd(int cpu) · 1 unmodified line
531531 cpu, mc_amd->hdr.patch_id);
532532 return UCODE_ERROR;
533533 }
534− pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
535− mc_amd->hdr.patch_id);
536534
537− uci->cpu_sig.rev = mc_amd->hdr.patch_id;
538− c->microcode = mc_amd->hdr.patch_id;
535+ rev = mc_amd->hdr.patch_id;
536+ ret = UCODE_UPDATED;
537+
538+ pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev);
539539
540− return UCODE_UPDATED;
540+out:
541+ uci->cpu_sig.rev = rev;
542+ c->microcode = rev;
543+
544+ /* Update boot_cpu_data's revision too, if we're on the BSP: */
545+ if (c->cpu_index == boot_cpu_data.cpu_index)
546+ boot_cpu_data.microcode = rev;
547+
548+ return ret;
541549 }
542550
543551 static int install_equiv_cpu_table(const u8 *buf)
arch/x86/kernel/cpu/microcode/intel.c+12−5
@@ -795,6 +795,7 @@ static enum ucode_state apply_microcode_intel(int cpu) · 794 unmodified lines
795795 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
796796 struct cpuinfo_x86 *c = &cpu_data(cpu);
797797 struct microcode_intel *mc;
798+ enum ucode_state ret;
798799 static int prev_rev;
799800 u32 rev;
800801
@@ -817,9 +818,8 @@ static enum ucode_state apply_microcode_intel(int cpu) · 16 unmodified lines
817818 */
818819 rev = intel_get_microcode_revision();
819820 if (rev >= mc->hdr.rev) {
820− uci->cpu_sig.rev = rev;
821− c->microcode = rev;
822− return UCODE_OK;
821+ ret = UCODE_OK;
822+ goto out;
823823 }
824824
825825 /*
@@ -848,10 +848,17 @@ static enum ucode_state apply_microcode_intel(int cpu) · 22 unmodified lines
848848 prev_rev = rev;
849849 }
850850
851+ ret = UCODE_UPDATED;
852+
853+out:
851854 uci->cpu_sig.rev = rev;
852− c->microcode = rev;
855+ c->microcode = rev;
856+
857+ /* Update boot_cpu_data's revision too, if we're on the BSP: */
858+ if (c->cpu_index == boot_cpu_data.cpu_index)
859+ boot_cpu_data.microcode = rev;
853860
854− return UCODE_UPDATED;
861+ return ret;
855862 }
856863
857864 static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
arch/x86/kernel/dumpstack.c+3−8
@@ -146,7 +146,7 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs, · 145 unmodified lines
146146 * they can be printed in the right context.
147147 */
148148 if (!partial && on_stack(info, regs, sizeof(*regs))) {
149− __show_regs(regs, 0);
149+ __show_regs(regs, SHOW_REGS_SHORT);
150150
151151 } else if (partial && on_stack(info, (void *)regs + IRET_FRAME_OFFSET,
152152 IRET_FRAME_SIZE)) {
@@ -344,7 +344,7 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr) · 191 unmodified lines
344344 oops_exit();
345345
346346 /* Executive summary in case the oops scrolled away */
347− __show_regs(&exec_summary_regs, true);
347+ __show_regs(&exec_summary_regs, SHOW_REGS_ALL);
348348
349349 if (!signr)
350350 return;
@@ -407,14 +407,9 @@ void die(const char *str, struct pt_regs *regs, long err) · 56 unmodified lines
407407
408408 void show_regs(struct pt_regs *regs)
409409 {
410− bool all = true;
411−
412410 show_regs_print_info(KERN_DEFAULT);
413411
414− if (IS_ENABLED(CONFIG_X86_32))
415− all = !user_mode(regs);
416−
417− __show_regs(regs, all);
412+ __show_regs(regs, user_mode(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL);
418413
419414 /*
420415 * When in-kernel, we also print out the stack at the time of the fault..
arch/x86/kernel/eisa.c+8−2
@@ -7,11 +7,17 @@ · 6 unmodified lines
77 #include <linux/eisa.h>
88 #include <linux/io.h>
99
10+#include <xen/xen.h>
11+
1012 static __init int eisa_bus_probe(void)
1113 {
12− void __iomem *p = ioremap(0x0FFFD9, 4);
14+ void __iomem *p;
15+
16+ if (xen_pv_domain() && !xen_initial_domain())
17+ return 0;
1318
14− if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))
19+ p = ioremap(0x0FFFD9, 4);
20+ if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
1521 EISA_bus = 1;
1622 iounmap(p);
1723 return 0;
arch/x86/kernel/head64.c+19−1
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <asm/bootparam_utils.h>
3636 #include <asm/microcode.h>
3737 #include <asm/kasan.h>
38+#include <asm/fixmap.h>
3839
3940 /*
4041 * Manage page tables very early on.
@@ -112,6 +113,7 @@ static bool __head check_la57_support(unsigned long physaddr) · 71 unmodified lines
112113 unsigned long __head __startup_64(unsigned long physaddr,
113114 struct boot_params *bp)
114115 {
116+ unsigned long vaddr, vaddr_end;
115117 unsigned long load_delta, *p;
116118 unsigned long pgtable_flags;
117119 pgdval_t *pgd;
@@ -165,7 +167,8 @@ unsigned long __head __startup_64(unsigned long physaddr, · 47 unmodified lines
165167 pud[511] += load_delta;
166168
167169 pmd = fixup_pointer(level2_fixmap_pgt, physaddr);
168− pmd[506] += load_delta;
170+ for (i = FIXMAP_PMD_TOP; i > FIXMAP_PMD_TOP - FIXMAP_PMD_NUM; i--)
171+ pmd[i] += load_delta;
169172
170173 /*
171174 * Set up the identity mapping for the switchover. These
@@ -234,6 +237,21 @@ unsigned long __head __startup_64(unsigned long physaddr, · 62 unmodified lines
234237 /* Encrypt the kernel and related (if SME is active) */
235238 sme_encrypt_kernel(bp);
236239
240+ /*
241+ * Clear the memory encryption mask from the .bss..decrypted section.
242+ * The bss section will be memset to zero later in the initialization so
243+ * there is no need to zero it after changing the memory encryption
244+ * attribute.
245+ */
246+ if (mem_encrypt_active()) {
247+ vaddr = (unsigned long)__start_bss_decrypted;
248+ vaddr_end = (unsigned long)__end_bss_decrypted;
249+ for (; vaddr < vaddr_end; vaddr += PMD_SIZE) {
250+ i = pmd_index(vaddr);
251+ pmd[i] -= sme_get_me_mask();
252+ }
253+ }
254+
237255 /*
238256 * Return the SME encryption mask (if SME is active) to be used as a
239257 * modifier for the initial pgdir entry programmed into CR3.
arch/x86/kernel/head_64.S+12−4
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include "../entry/calling.h"
2525 #include <asm/export.h>
2626 #include <asm/nospec-branch.h>
27+#include <asm/fixmap.h>
2728
2829 #ifdef CONFIG_PARAVIRT
2930 #include <asm/asm-offsets.h>
@@ -445,13 +446,20 @@ NEXT_PAGE(level2_kernel_pgt) · 415 unmodified lines
445446 KERNEL_IMAGE_SIZE/PMD_SIZE)
446447
447448 NEXT_PAGE(level2_fixmap_pgt)
448− .fill 506,8,0
449− .quad level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
450− /* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */
451− .fill 5,8,0
449+ .fill (512 - 4 - FIXMAP_PMD_NUM),8,0
450+ pgtno = 0
451+ .rept (FIXMAP_PMD_NUM)
452+ .quad level1_fixmap_pgt + (pgtno << PAGE_SHIFT) - __START_KERNEL_map \
453+ + _PAGE_TABLE_NOENC;
454+ pgtno = pgtno + 1
455+ .endr
456+ /* 6 MB reserved space + a 2MB hole */
457+ .fill 4,8,0
452458
453459 NEXT_PAGE(level1_fixmap_pgt)
460+ .rept (FIXMAP_PMD_NUM)
454461 .fill 512,8,0
462+ .endr
455463
456464 #undef PMDS
457465
arch/x86/kernel/kvmclock.c+49−3
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/sched/clock.h>
2929 #include <linux/mm.h>
3030 #include <linux/slab.h>
31+#include <linux/set_memory.h>
3132
3233 #include <asm/hypervisor.h>
3334 #include <asm/mem_encrypt.h>
@@ -61,9 +62,10 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); · 27 unmodified lines
6162 (PAGE_SIZE / sizeof(struct pvclock_vsyscall_time_info))
6263
6364 static struct pvclock_vsyscall_time_info
64− hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __aligned(PAGE_SIZE);
65−static struct pvclock_wall_clock wall_clock;
65+ hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE);
66+static struct pvclock_wall_clock wall_clock __bss_decrypted;
6667 static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu);
68+static struct pvclock_vsyscall_time_info *hvclock_mem;
6769
6870 static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void)
6971 {
@@ -236,6 +238,45 @@ static void kvm_shutdown(void) · 166 unmodified lines
236238 native_machine_shutdown();
237239 }
238240
241+static void __init kvmclock_init_mem(void)
242+{
243+ unsigned long ncpus;
244+ unsigned int order;
245+ struct page *p;
246+ int r;
247+
248+ if (HVC_BOOT_ARRAY_SIZE >= num_possible_cpus())
249+ return;
250+
251+ ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE;
252+ order = get_order(ncpus * sizeof(*hvclock_mem));
253+
254+ p = alloc_pages(GFP_KERNEL, order);
255+ if (!p) {
256+ pr_warn("%s: failed to alloc %d pages", __func__, (1U << order));
257+ return;
258+ }
259+
260+ hvclock_mem = page_address(p);
261+
262+ /*
263+ * hvclock is shared between the guest and the hypervisor, must
264+ * be mapped decrypted.
265+ */
266+ if (sev_active()) {
267+ r = set_memory_decrypted((unsigned long) hvclock_mem,
268+ 1UL << order);
269+ if (r) {
270+ __free_pages(p, order);
271+ hvclock_mem = NULL;
272+ pr_warn("kvmclock: set_memory_decrypted() failed. Disabling\n");
273+ return;
274+ }
275+ }
276+
277+ memset(hvclock_mem, 0, PAGE_SIZE << order);
278+}
279+
239280 static int __init kvm_setup_vsyscall_timeinfo(void)
240281 {
241282 #ifdef CONFIG_X86_64
@@ -250,6 +291,9 @@ static int __init kvm_setup_vsyscall_timeinfo(void) · 8 unmodified lines
250291
251292 kvm_clock.archdata.vclock_mode = VCLOCK_PVCLOCK;
252293 #endif
294+
295+ kvmclock_init_mem();
296+
253297 return 0;
254298 }
255299 early_initcall(kvm_setup_vsyscall_timeinfo);
@@ -269,8 +313,10 @@ static int kvmclock_setup_percpu(unsigned int cpu) · 13 unmodified lines
269313 /* Use the static page for the first CPUs, allocate otherwise */
270314 if (cpu < HVC_BOOT_ARRAY_SIZE)
271315 p = &hv_clock_boot[cpu];
316+ else if (hvclock_mem)
317+ p = hvclock_mem + cpu - HVC_BOOT_ARRAY_SIZE;
272318 else
273− p = kzalloc(sizeof(*p), GFP_KERNEL);
319+ return -ENOMEM;
274320
275321 per_cpu(hv_clock_per_cpu, cpu) = p;
276322 return p ? 0 : -ENOMEM;
arch/x86/kernel/paravirt.c+2−2
@@ -91,7 +91,7 @@ unsigned paravirt_patch_call(void *insnbuf, · 90 unmodified lines
9191
9292 if (len < 5) {
9393 #ifdef CONFIG_RETPOLINE
94− WARN_ONCE("Failing to patch indirect CALL in %ps\n", (void *)addr);
94+ WARN_ONCE(1, "Failing to patch indirect CALL in %ps\n", (void *)addr);
9595 #endif
9696 return len; /* call too long for patch site */
9797 }
@@ -111,7 +111,7 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target, · 13 unmodified lines
111111
112112 if (len < 5) {
113113 #ifdef CONFIG_RETPOLINE
114− WARN_ONCE("Failing to patch indirect JMP in %ps\n", (void *)addr);
114+ WARN_ONCE(1, "Failing to patch indirect JMP in %ps\n", (void *)addr);
115115 #endif
116116 return len; /* call too long for patch site */
117117 }
arch/x86/kernel/process_32.c+2−2
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 #include <asm/intel_rdt_sched.h>
6060 #include <asm/proto.h>
6161
62−void __show_regs(struct pt_regs *regs, int all)
62+void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
6363 {
6464 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
6565 unsigned long d0, d1, d2, d3, d6, d7;
@@ -85,7 +85,7 @@ void __show_regs(struct pt_regs *regs, int all) · 19 unmodified lines
8585 printk(KERN_DEFAULT "DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x EFLAGS: %08lx\n",
8686 (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss, regs->flags);
8787
88− if (!all)
88+ if (mode != SHOW_REGS_ALL)
8989 return;
9090
9191 cr0 = read_cr0();
arch/x86/kernel/process_64.c+10−2
@@ -62,7 +62,7 @@ · 61 unmodified lines
6262 __visible DEFINE_PER_CPU(unsigned long, rsp_scratch);
6363
6464 /* Prints also some state that isn't saved in the pt_regs */
65−void __show_regs(struct pt_regs *regs, int all)
65+void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
6666 {
6767 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
6868 unsigned long d0, d1, d2, d3, d6, d7;
@@ -87,9 +87,17 @@ void __show_regs(struct pt_regs *regs, int all) · 18 unmodified lines
8787 printk(KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n",
8888 regs->r13, regs->r14, regs->r15);
8989
90− if (!all)
90+ if (mode == SHOW_REGS_SHORT)
9191 return;
9292
93+ if (mode == SHOW_REGS_USER) {
94+ rdmsrl(MSR_FS_BASE, fs);
95+ rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
96+ printk(KERN_DEFAULT "FS: %016lx GS: %016lx\n",
97+ fs, shadowgs);
98+ return;
99+ }
100+
93101 asm("movl %%ds,%0" : "=r" (ds));
94102 asm("movl %%cs,%0" : "=r" (cs));
95103 asm("movl %%es,%0" : "=r" (es));
arch/x86/kernel/topology.c+3−1
@@ -111,8 +111,10 @@ int arch_register_cpu(int num) · 110 unmodified lines
111111 /*
112112 * Currently CPU0 is only hotpluggable on Intel platforms. Other
113113 * vendors can add hotplug support later.
114+ * Xen PV guests don't support CPU0 hotplug at all.
114115 */
115− if (c->x86_vendor != X86_VENDOR_INTEL)
116+ if (c->x86_vendor != X86_VENDOR_INTEL ||
117+ boot_cpu_has(X86_FEATURE_XENPV))
116118 cpu0_hotpluggable = 0;
117119
118120 /*
arch/x86/kernel/tsc.c+1−1
@@ -1415,7 +1415,7 @@ static bool __init determine_cpu_tsc_frequencies(bool early) · 1414 unmodified lines
14151415
14161416 static unsigned long __init get_loops_per_jiffy(void)
14171417 {
1418− unsigned long lpj = tsc_khz * KHZ;
1418+ u64 lpj = (u64)tsc_khz * KHZ;
14191419
14201420 do_div(lpj, HZ);
14211421 return lpj;
arch/x86/kernel/vmlinux.lds.S+19−0
@@ -65,6 +65,23 @@ jiffies_64 = jiffies; · 64 unmodified lines
6565 #define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE);
6666 #define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE);
6767
68+/*
69+ * This section contains data which will be mapped as decrypted. Memory
70+ * encryption operates on a page basis. Make this section PMD-aligned
71+ * to avoid splitting the pages while mapping the section early.
72+ *
73+ * Note: We use a separate section so that only this section gets
74+ * decrypted to avoid exposing more than we wish.
75+ */
76+#define BSS_DECRYPTED \
77+ . = ALIGN(PMD_SIZE); \
78+ __start_bss_decrypted = .; \
79+ *(.bss..decrypted); \
80+ . = ALIGN(PAGE_SIZE); \
81+ __start_bss_decrypted_unused = .; \
82+ . = ALIGN(PMD_SIZE); \
83+ __end_bss_decrypted = .; \
84+
6885 #else
6986
7087 #define X86_ALIGN_RODATA_BEGIN
@@ -74,6 +91,7 @@ jiffies_64 = jiffies; · 3 unmodified lines
7491
7592 #define ALIGN_ENTRY_TEXT_BEGIN
7693 #define ALIGN_ENTRY_TEXT_END
94+#define BSS_DECRYPTED
7795
7896 #endif
7997
@@ -355,6 +373,7 @@ SECTIONS · 275 unmodified lines
355373 __bss_start = .;
356374 *(.bss..page_aligned)
357375 *(.bss)
376+ BSS_DECRYPTED
358377 . = ALIGN(PAGE_SIZE);
359378 __bss_stop = .;
360379 }
arch/x86/kvm/lapic.c+39−10
@@ -548,7 +548,7 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq, · 547 unmodified lines
548548 }
549549
550550 int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low,
551− unsigned long ipi_bitmap_high, int min,
551+ unsigned long ipi_bitmap_high, u32 min,
552552 unsigned long icr, int op_64_bit)
553553 {
554554 int i;
@@ -571,18 +571,31 @@ int kvm_pv_send_ipi(struct kvm *kvm, unsigned long ipi_bitmap_low, · 16 unmodified lines
571571 rcu_read_lock();
572572 map = rcu_dereference(kvm->arch.apic_map);
573573
574+ if (min > map->max_apic_id)
575+ goto out;
574576 /* Bits above cluster_size are masked in the caller. */
575− for_each_set_bit(i, &ipi_bitmap_low, BITS_PER_LONG) {
576− vcpu = map->phys_map[min + i]->vcpu;
577− count += kvm_apic_set_irq(vcpu, &irq, NULL);
577+ for_each_set_bit(i, &ipi_bitmap_low,
578+ min((u32)BITS_PER_LONG, (map->max_apic_id - min + 1))) {
579+ if (map->phys_map[min + i]) {
580+ vcpu = map->phys_map[min + i]->vcpu;
581+ count += kvm_apic_set_irq(vcpu, &irq, NULL);
582+ }
578583 }
579584
580585 min += cluster_size;
581− for_each_set_bit(i, &ipi_bitmap_high, BITS_PER_LONG) {
582− vcpu = map->phys_map[min + i]->vcpu;
583− count += kvm_apic_set_irq(vcpu, &irq, NULL);
586+
587+ if (min > map->max_apic_id)
588+ goto out;
589+
590+ for_each_set_bit(i, &ipi_bitmap_high,
591+ min((u32)BITS_PER_LONG, (map->max_apic_id - min + 1))) {
592+ if (map->phys_map[min + i]) {
593+ vcpu = map->phys_map[min + i]->vcpu;
594+ count += kvm_apic_set_irq(vcpu, &irq, NULL);
595+ }
584596 }
585597
598+out:
586599 rcu_read_unlock();
587600 return count;
588601 }
@@ -1331,9 +1344,8 @@ EXPORT_SYMBOL_GPL(kvm_lapic_reg_read); · 742 unmodified lines
13311344
13321345 static int apic_mmio_in_range(struct kvm_lapic *apic, gpa_t addr)
13331346 {
1334− return kvm_apic_hw_enabled(apic) &&
1335− addr >= apic->base_address &&
1336− addr < apic->base_address + LAPIC_MMIO_LENGTH;
1347+ return addr >= apic->base_address &&
1348+ addr < apic->base_address + LAPIC_MMIO_LENGTH;
13371349 }
13381350
13391351 static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
@@ -1345,6 +1357,15 @@ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this, · 5 unmodified lines
13451357 if (!apic_mmio_in_range(apic, address))
13461358 return -EOPNOTSUPP;
13471359
1360+ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) {
1361+ if (!kvm_check_has_quirk(vcpu->kvm,
1362+ KVM_X86_QUIRK_LAPIC_MMIO_HOLE))
1363+ return -EOPNOTSUPP;
1364+
1365+ memset(data, 0xff, len);
1366+ return 0;
1367+ }
1368+
13481369 kvm_lapic_reg_read(apic, offset, len, data);
13491370
13501371 return 0;
@@ -1904,6 +1925,14 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, · 553 unmodified lines
19041925 if (!apic_mmio_in_range(apic, address))
19051926 return -EOPNOTSUPP;
19061927
1928+ if (!kvm_apic_hw_enabled(apic) || apic_x2apic_mode(apic)) {
1929+ if (!kvm_check_has_quirk(vcpu->kvm,
1930+ KVM_X86_QUIRK_LAPIC_MMIO_HOLE))
1931+ return -EOPNOTSUPP;
1932+
1933+ return 0;
1934+ }
1935+
19071936 /*
19081937 * APIC register must be aligned on 128-bits boundary.
19091938 * 32/64/128 bits registers must be accessed thru 32 bits.
arch/x86/kvm/mmu.c+22−13
@@ -899,7 +899,7 @@ static void walk_shadow_page_lockless_end(struct kvm_vcpu *vcpu) · 898 unmodified lines
899899 {
900900 /*
901901 * Make sure the write to vcpu->mode is not reordered in front of
902− * reads to sptes. If it does, kvm_commit_zap_page() can see us
902+ * reads to sptes. If it does, kvm_mmu_commit_zap_page() can see us
903903 * OUTSIDE_GUEST_MODE and proceed to free the shadow page table.
904904 */
905905 smp_store_release(&vcpu->mode, OUTSIDE_GUEST_MODE);
@@ -1853,11 +1853,6 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, · 947 unmodified lines
18531853 return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler);
18541854 }
18551855
1856−int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
1857−{
1858− return kvm_handle_hva(kvm, hva, 0, kvm_unmap_rmapp);
1859−}
1860−
18611856 int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
18621857 {
18631858 return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
@@ -5217,7 +5212,7 @@ static int make_mmu_pages_available(struct kvm_vcpu *vcpu) · 3353 unmodified lines
52175212 int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
52185213 void *insn, int insn_len)
52195214 {
5220− int r, emulation_type = EMULTYPE_RETRY;
5215+ int r, emulation_type = 0;
52215216 enum emulation_result er;
52225217 bool direct = vcpu->arch.mmu.direct_map;
52235218
@@ -5230,10 +5225,8 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, · 6 unmodified lines
52305225 r = RET_PF_INVALID;
52315226 if (unlikely(error_code & PFERR_RSVD_MASK)) {
52325227 r = handle_mmio_page_fault(vcpu, cr2, direct);
5233− if (r == RET_PF_EMULATE) {
5234− emulation_type = 0;
5228+ if (r == RET_PF_EMULATE)
52355229 goto emulate;
5236− }
52375230 }
52385231
52395232 if (r == RET_PF_INVALID) {
@@ -5260,8 +5253,19 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code, · 20 unmodified lines
52605253 return 1;
52615254 }
52625255
5263− if (mmio_info_in_cache(vcpu, cr2, direct))
5264− emulation_type = 0;
5256+ /*
5257+ * vcpu->arch.mmu.page_fault returned RET_PF_EMULATE, but we can still
5258+ * optimistically try to just unprotect the page and let the processor
5259+ * re-execute the instruction that caused the page fault. Do not allow
5260+ * retrying MMIO emulation, as it's not only pointless but could also
5261+ * cause us to enter an infinite loop because the processor will keep
5262+ * faulting on the non-existent MMIO address. Retrying an instruction
5263+ * from a nested guest is also pointless and dangerous as we are only
5264+ * explicitly shadowing L1's page tables, i.e. unprotecting something
5265+ * for L1 isn't going to magically fix whatever issue cause L2 to fail.
5266+ */
5267+ if (!mmio_info_in_cache(vcpu, cr2, direct) && !is_guest_mode(vcpu))
5268+ emulation_type = EMULTYPE_ALLOW_RETRY;
52655269 emulate:
52665270 /*
52675271 * On AMD platforms, under certain conditions insn_len may be zero on #NPF.
@@ -5413,7 +5417,12 @@ void kvm_mmu_setup(struct kvm_vcpu *vcpu) · 145 unmodified lines
54135417 {
54145418 MMU_WARN_ON(VALID_PAGE(vcpu->arch.mmu.root_hpa));
54155419
5416− kvm_init_mmu(vcpu, true);
5420+ /*
5421+ * kvm_mmu_setup() is called only on vCPU initialization.
5422+ * Therefore, no need to reset mmu roots as they are not yet
5423+ * initialized.
5424+ */
5425+ kvm_init_mmu(vcpu, false);
54175426 }
54185427
54195428 static void kvm_mmu_invalidate_zap_pages_in_memslot(struct kvm *kvm,
arch/x86/kvm/svm.c+13−13
@@ -776,7 +776,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) · 775 unmodified lines
776776 }
777777
778778 if (!svm->next_rip) {
779− if (emulate_instruction(vcpu, EMULTYPE_SKIP) !=
779+ if (kvm_emulate_instruction(vcpu, EMULTYPE_SKIP) !=
780780 EMULATE_DONE)
781781 printk(KERN_DEBUG "%s: NOP\n", __func__);
782782 return;
@@ -1226,8 +1226,7 @@ static __init int sev_hardware_setup(void) · 443 unmodified lines
12261226 min_sev_asid = cpuid_edx(0x8000001F);
12271227
12281228 /* Initialize SEV ASID bitmap */
1229− sev_asid_bitmap = kcalloc(BITS_TO_LONGS(max_sev_asid),
1230− sizeof(unsigned long), GFP_KERNEL);
1229+ sev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);
12311230 if (!sev_asid_bitmap)
12321231 return 1;
12331232
@@ -1405,7 +1404,7 @@ static __exit void svm_hardware_unsetup(void) · 171 unmodified lines
14051404 int cpu;
14061405
14071406 if (svm_sev_enabled())
1408− kfree(sev_asid_bitmap);
1407+ bitmap_free(sev_asid_bitmap);
14091408
14101409 for_each_possible_cpu(cpu)
14111410 svm_cpu_uninit(cpu);
@@ -2715,7 +2714,7 @@ static int gp_interception(struct vcpu_svm *svm) · 1303 unmodified lines
27152714
27162715 WARN_ON_ONCE(!enable_vmware_backdoor);
27172716
2718− er = emulate_instruction(vcpu,
2717+ er = kvm_emulate_instruction(vcpu,
27192718 EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL);
27202719 if (er == EMULATE_USER_EXIT)
27212720 return 0;
@@ -2819,7 +2818,7 @@ static int io_interception(struct vcpu_svm *svm) · 97 unmodified lines
28192818 string = (io_info & SVM_IOIO_STR_MASK) != 0;
28202819 in = (io_info & SVM_IOIO_TYPE_MASK) != 0;
28212820 if (string)
2822− return emulate_instruction(vcpu, 0) == EMULATE_DONE;
2821+ return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE;
28232822
28242823 port = io_info >> 16;
28252824 size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT;
@@ -3861,7 +3860,7 @@ static int iret_interception(struct vcpu_svm *svm) · 1035 unmodified lines
38613860 static int invlpg_interception(struct vcpu_svm *svm)
38623861 {
38633862 if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
3864− return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
3863+ return kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
38653864
38663865 kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1);
38673866 return kvm_skip_emulated_instruction(&svm->vcpu);
@@ -3869,13 +3868,13 @@ static int invlpg_interception(struct vcpu_svm *svm) · 1 unmodified line
38693868
38703869 static int emulate_on_interception(struct vcpu_svm *svm)
38713870 {
3872− return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
3871+ return kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE;
38733872 }
38743873
38753874 static int rsm_interception(struct vcpu_svm *svm)
38763875 {
3877− return x86_emulate_instruction(&svm->vcpu, 0, 0,
3878− rsm_ins_bytes, 2) == EMULATE_DONE;
3876+ return kvm_emulate_instruction_from_buffer(&svm->vcpu,
3877+ rsm_ins_bytes, 2) == EMULATE_DONE;
38793878 }
38803879
38813880 static int rdpmc_interception(struct vcpu_svm *svm)
@@ -4700,7 +4699,7 @@ static int avic_unaccelerated_access_interception(struct vcpu_svm *svm) · 818 unmodified lines
47004699 ret = avic_unaccel_trap_write(svm);
47014700 } else {
47024701 /* Handling Fault */
4703− ret = (emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE);
4702+ ret = (kvm_emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE);
47044703 }
47054704
47064705 return ret;
@@ -6747,7 +6746,7 @@ e_free: · 2040 unmodified lines
67476746 static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec)
67486747 {
67496748 unsigned long vaddr, vaddr_end, next_vaddr;
6750− unsigned long dst_vaddr, dst_vaddr_end;
6749+ unsigned long dst_vaddr;
67516750 struct page **src_p, **dst_p;
67526751 struct kvm_sev_dbg debug;
67536752 unsigned long n;
@@ -6763,7 +6762,6 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 9 unmodified lines
67636762 size = debug.len;
67646763 vaddr_end = vaddr + size;
67656764 dst_vaddr = debug.dst_uaddr;
6766− dst_vaddr_end = dst_vaddr + size;
67676765
67686766 for (; vaddr < vaddr_end; vaddr = next_vaddr) {
67696767 int len, s_off, d_off;
@@ -7150,6 +7148,8 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { · 380 unmodified lines
71507148 .check_intercept = svm_check_intercept,
71517149 .handle_external_intr = svm_handle_external_intr,
71527150
7151+ .request_immediate_exit = __kvm_request_immediate_exit,
7152+
71537153 .sched_in = svm_sched_in,
71547154
71557155 .pmu_ops = &amd_pmu_ops,
arch/x86/kvm/vmx.c+131−50
@@ -397,6 +397,7 @@ struct loaded_vmcs { · 396 unmodified lines
397397 int cpu;
398398 bool launched;
399399 bool nmi_known_unmasked;
400+ bool hv_timer_armed;
400401 /* Support for vnmi-less CPUs */
401402 int soft_vnmi_blocked;
402403 ktime_t entry_time;
@@ -1019,6 +1020,8 @@ struct vcpu_vmx { · 616 unmodified lines
10191020 int ple_window;
10201021 bool ple_window_dirty;
10211022
1023+ bool req_immediate_exit;
1024+
10221025 /* Support for PML */
10231026 #define PML_ENTITY_NUM 512
10241027 struct page *pml_pg;
@@ -2864,6 +2867,8 @@ static void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) · 1839 unmodified lines
28642867 u16 fs_sel, gs_sel;
28652868 int i;
28662869
2870+ vmx->req_immediate_exit = false;
2871+
28672872 if (vmx->loaded_cpu_state)
28682873 return;
28692874
@@ -5393,9 +5398,10 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) · 2523 unmodified lines
53935398 * To use VMXON (and later other VMX instructions), a guest
53945399 * must first be able to turn on cr4.VMXE (see handle_vmon()).
53955400 * So basically the check on whether to allow nested VMX
5396− * is here.
5401+ * is here. We operate under the default treatment of SMM,
5402+ * so VMX cannot be enabled under SMM.
53975403 */
5398− if (!nested_vmx_allowed(vcpu))
5404+ if (!nested_vmx_allowed(vcpu) || is_smm(vcpu))
53995405 return 1;
54005406 }
54015407
@@ -6183,6 +6189,27 @@ static void vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) · 781 unmodified lines
61836189 nested_mark_vmcs12_pages_dirty(vcpu);
61846190 }
61856191
6192+static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)
6193+{
6194+ struct vcpu_vmx *vmx = to_vmx(vcpu);
6195+ void *vapic_page;
6196+ u32 vppr;
6197+ int rvi;
6198+
6199+ if (WARN_ON_ONCE(!is_guest_mode(vcpu)) ||
6200+ !nested_cpu_has_vid(get_vmcs12(vcpu)) ||
6201+ WARN_ON_ONCE(!vmx->nested.virtual_apic_page))
6202+ return false;
6203+
6204+ rvi = vmcs_read16(GUEST_INTR_STATUS) & 0xff;
6205+
6206+ vapic_page = kmap(vmx->nested.virtual_apic_page);
6207+ vppr = *((u32 *)(vapic_page + APIC_PROCPRI));
6208+ kunmap(vmx->nested.virtual_apic_page);
6209+
6210+ return ((rvi & 0xf0) > (vppr & 0xf0));
6211+}
6212+
61866213 static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
61876214 bool nested)
61886215 {
@@ -6983,7 +7010,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, · 794 unmodified lines
69837010 * Cause the #SS fault with 0 error code in VM86 mode.
69847011 */
69857012 if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) {
6986− if (emulate_instruction(vcpu, 0) == EMULATE_DONE) {
7013+ if (kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE) {
69877014 if (vcpu->arch.halt_request) {
69887015 vcpu->arch.halt_request = 0;
69897016 return kvm_vcpu_halt(vcpu);
@@ -7054,7 +7081,7 @@ static int handle_exception(struct kvm_vcpu *vcpu) · 64 unmodified lines
70547081
70557082 if (!vmx->rmode.vm86_active && is_gp_fault(intr_info)) {
70567083 WARN_ON_ONCE(!enable_vmware_backdoor);
7057− er = emulate_instruction(vcpu,
7084+ er = kvm_emulate_instruction(vcpu,
70587085 EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL);
70597086 if (er == EMULATE_USER_EXIT)
70607087 return 0;
@@ -7157,7 +7184,7 @@ static int handle_io(struct kvm_vcpu *vcpu) · 96 unmodified lines
71577184 ++vcpu->stat.io_exits;
71587185
71597186 if (string)
7160− return emulate_instruction(vcpu, 0) == EMULATE_DONE;
7187+ return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE;
71617188
71627189 port = exit_qualification >> 16;
71637190 size = (exit_qualification & 7) + 1;
@@ -7231,7 +7258,7 @@ static int handle_set_cr4(struct kvm_vcpu *vcpu, unsigned long val) · 67 unmodified lines
72317258 static int handle_desc(struct kvm_vcpu *vcpu)
72327259 {
72337260 WARN_ON(!(vcpu->arch.cr4 & X86_CR4_UMIP));
7234− return emulate_instruction(vcpu, 0) == EMULATE_DONE;
7261+ return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE;
72357262 }
72367263
72377264 static int handle_cr(struct kvm_vcpu *vcpu)
@@ -7480,7 +7507,7 @@ static int handle_vmcall(struct kvm_vcpu *vcpu) · 242 unmodified lines
74807507
74817508 static int handle_invd(struct kvm_vcpu *vcpu)
74827509 {
7483− return emulate_instruction(vcpu, 0) == EMULATE_DONE;
7510+ return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE;
74847511 }
74857512
74867513 static int handle_invlpg(struct kvm_vcpu *vcpu)
@@ -7547,7 +7574,7 @@ static int handle_apic_access(struct kvm_vcpu *vcpu) · 60 unmodified lines
75477574 return kvm_skip_emulated_instruction(vcpu);
75487575 }
75497576 }
7550− return emulate_instruction(vcpu, 0) == EMULATE_DONE;
7577+ return kvm_emulate_instruction(vcpu, 0) == EMULATE_DONE;
75517578 }
75527579
75537580 static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu)
@@ -7704,8 +7731,8 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu) · 150 unmodified lines
77047731 if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
77057732 return kvm_skip_emulated_instruction(vcpu);
77067733 else
7707− return x86_emulate_instruction(vcpu, gpa, EMULTYPE_SKIP,
7708− NULL, 0) == EMULATE_DONE;
7734+ return kvm_emulate_instruction(vcpu, EMULTYPE_SKIP) ==
7735+ EMULATE_DONE;
77097736 }
77107737
77117738 return kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
@@ -7748,7 +7775,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) · 36 unmodified lines
77487775 if (kvm_test_request(KVM_REQ_EVENT, vcpu))
77497776 return 1;
77507777
7751− err = emulate_instruction(vcpu, 0);
7778+ err = kvm_emulate_instruction(vcpu, 0);
77527779
77537780 if (err == EMULATE_USER_EXIT) {
77547781 ++vcpu->stat.mmio_exits;
@@ -7966,6 +7993,9 @@ static __init int hardware_setup(void) · 211 unmodified lines
79667993 kvm_x86_ops->enable_log_dirty_pt_masked = NULL;
79677994 }
79687995
7996+ if (!cpu_has_vmx_preemption_timer())
7997+ kvm_x86_ops->request_immediate_exit = __kvm_request_immediate_exit;
7998+
79697999 if (cpu_has_vmx_preemption_timer() && enable_preemption_timer) {
79708000 u64 vmx_msr;
79718001
@@ -9208,7 +9238,8 @@ static int handle_pml_full(struct kvm_vcpu *vcpu) · 1236 unmodified lines
92089238
92099239 static int handle_preemption_timer(struct kvm_vcpu *vcpu)
92109240 {
9211− kvm_lapic_expired_hv_timer(vcpu);
9241+ if (!to_vmx(vcpu)->req_immediate_exit)
9242+ kvm_lapic_expired_hv_timer(vcpu);
92129243 return 1;
92139244 }
92149245
@@ -10595,24 +10626,43 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) · 1380 unmodified lines
1059510626 msrs[i].host, false);
1059610627 }
1059710628
10598−static void vmx_arm_hv_timer(struct kvm_vcpu *vcpu)
10629+static void vmx_arm_hv_timer(struct vcpu_vmx *vmx, u32 val)
10630+{
10631+ vmcs_write32(VMX_PREEMPTION_TIMER_VALUE, val);
10632+ if (!vmx->loaded_vmcs->hv_timer_armed)
10633+ vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
10634+ PIN_BASED_VMX_PREEMPTION_TIMER);
10635+ vmx->loaded_vmcs->hv_timer_armed = true;
10636+}
10637+
10638+static void vmx_update_hv_timer(struct kvm_vcpu *vcpu)
1059910639 {
1060010640 struct vcpu_vmx *vmx = to_vmx(vcpu);
1060110641 u64 tscl;
1060210642 u32 delta_tsc;
1060310643
10604− if (vmx->hv_deadline_tsc == -1)
10644+ if (vmx->req_immediate_exit) {
10645+ vmx_arm_hv_timer(vmx, 0);
1060510646 return;
10647+ }
1060610648
10607− tscl = rdtsc();
10608− if (vmx->hv_deadline_tsc > tscl)
10609− /* sure to be 32 bit only because checked on set_hv_timer */
10610− delta_tsc = (u32)((vmx->hv_deadline_tsc - tscl) >>
10611− cpu_preemption_timer_multi);
10612− else
10613− delta_tsc = 0;
10649+ if (vmx->hv_deadline_tsc != -1) {
10650+ tscl = rdtsc();
10651+ if (vmx->hv_deadline_tsc > tscl)
10652+ /* set_hv_timer ensures the delta fits in 32-bits */
10653+ delta_tsc = (u32)((vmx->hv_deadline_tsc - tscl) >>
10654+ cpu_preemption_timer_multi);
10655+ else
10656+ delta_tsc = 0;
10657+
10658+ vmx_arm_hv_timer(vmx, delta_tsc);
10659+ return;
10660+ }
1061410661
10615− vmcs_write32(VMX_PREEMPTION_TIMER_VALUE, delta_tsc);
10662+ if (vmx->loaded_vmcs->hv_timer_armed)
10663+ vmcs_clear_bits(PIN_BASED_VM_EXEC_CONTROL,
10664+ PIN_BASED_VMX_PREEMPTION_TIMER);
10665+ vmx->loaded_vmcs->hv_timer_armed = false;
1061610666 }
1061710667
1061810668 static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
@@ -10672,7 +10722,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) · 53 unmodified lines
1067210722
1067310723 atomic_switch_perf_msrs(vmx);
1067410724
10675− vmx_arm_hv_timer(vcpu);
10725+ vmx_update_hv_timer(vcpu);
1067610726
1067710727 /*
1067810728 * If this vCPU has touched SPEC_CTRL, restore the guest's value if
@@ -11427,16 +11477,18 @@ static void vmx_start_preemption_timer(struct kvm_vcpu *vcpu) · 748 unmodified lines
1142711477 u64 preemption_timeout = get_vmcs12(vcpu)->vmx_preemption_timer_value;
1142811478 struct vcpu_vmx *vmx = to_vmx(vcpu);
1142911479
11430− if (vcpu->arch.virtual_tsc_khz == 0)
11431− return;
11432−
11433− /* Make sure short timeouts reliably trigger an immediate vmexit.
11434− * hrtimer_start does not guarantee this. */
11435− if (preemption_timeout <= 1) {
11480+ /*
11481+ * A timer value of zero is architecturally guaranteed to cause
11482+ * a VMExit prior to executing any instructions in the guest.
11483+ */
11484+ if (preemption_timeout == 0) {
1143611485 vmx_preemption_timer_fn(&vmx->nested.preemption_timer);
1143711486 return;
1143811487 }
1143911488
11489+ if (vcpu->arch.virtual_tsc_khz == 0)
11490+ return;
11491+
1144011492 preemption_timeout <<= VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE;
1144111493 preemption_timeout *= 1000000;
1144211494 do_div(preemption_timeout, vcpu->arch.virtual_tsc_khz);
@@ -11646,11 +11698,15 @@ static int nested_vmx_check_apicv_controls(struct kvm_vcpu *vcpu, · 203 unmodified lines
1164611698 * bits 15:8 should be zero in posted_intr_nv,
1164711699 * the descriptor address has been already checked
1164811700 * in nested_get_vmcs12_pages.
11701+ *
11702+ * bits 5:0 of posted_intr_desc_addr should be zero.
1164911703 */
1165011704 if (nested_cpu_has_posted_intr(vmcs12) &&
1165111705 (!nested_cpu_has_vid(vmcs12) ||
1165211706 !nested_exit_intr_ack_set(vcpu) ||
11653− vmcs12->posted_intr_nv & 0xff00))
11707+ (vmcs12->posted_intr_nv & 0xff00) ||
11708+ (vmcs12->posted_intr_desc_addr & 0x3f) ||
11709+ (!page_address_valid(vcpu, vmcs12->posted_intr_desc_addr))))
1165411710 return -EINVAL;
1165511711
1165611712 /* tpr shadow is needed by all apicv features. */
@@ -12076,11 +12132,10 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, · 419 unmodified lines
1207612132
1207712133 exec_control = vmcs12->pin_based_vm_exec_control;
1207812134
12079− /* Preemption timer setting is only taken from vmcs01. */
12080− exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER;
12135+ /* Preemption timer setting is computed directly in vmx_vcpu_run. */
1208112136 exec_control |= vmcs_config.pin_based_exec_ctrl;
12082− if (vmx->hv_deadline_tsc == -1)
12083− exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER;
12137+ exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER;
12138+ vmx->loaded_vmcs->hv_timer_armed = false;
1208412139
1208512140 /* Posted interrupts setting is only taken from vmcs12. */
1208612141 if (nested_cpu_has_posted_intr(vmcs12)) {
@@ -12318,6 +12373,9 @@ static int check_vmentry_prereqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) · 231 unmodified lines
1231812373 vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT)
1231912374 return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
1232012375
12376+ if (nested_cpu_has_vpid(vmcs12) && !vmcs12->virtual_processor_id)
12377+ return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
12378+
1232112379 if (nested_vmx_check_io_bitmap_controls(vcpu, vmcs12))
1232212380 return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
1232312381
@@ -12537,8 +12595,11 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) · 213 unmodified lines
1253712595 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
1253812596 bool from_vmentry = !!exit_qual;
1253912597 u32 dummy_exit_qual;
12598+ u32 vmcs01_cpu_exec_ctrl;
1254012599 int r = 0;
1254112600
12601+ vmcs01_cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
12602+
1254212603 enter_guest_mode(vcpu);
1254312604
1254412605 if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS))
@@ -12574,6 +12635,25 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) · 29 unmodified lines
1257412635 kvm_make_request(KVM_REQ_GET_VMCS12_PAGES, vcpu);
1257512636 }
1257612637
12638+ /*
12639+ * If L1 had a pending IRQ/NMI until it executed
12640+ * VMLAUNCH/VMRESUME which wasn't delivered because it was
12641+ * disallowed (e.g. interrupts disabled), L0 needs to
12642+ * evaluate if this pending event should cause an exit from L2
12643+ * to L1 or delivered directly to L2 (e.g. In case L1 don't
12644+ * intercept EXTERNAL_INTERRUPT).
12645+ *
12646+ * Usually this would be handled by L0 requesting a
12647+ * IRQ/NMI window by setting VMCS accordingly. However,
12648+ * this setting was done on VMCS01 and now VMCS02 is active
12649+ * instead. Thus, we force L0 to perform pending event
12650+ * evaluation by requesting a KVM_REQ_EVENT.
12651+ */
12652+ if (vmcs01_cpu_exec_ctrl &
12653+ (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING)) {
12654+ kvm_make_request(KVM_REQ_EVENT, vcpu);
12655+ }
12656+
1257712657 /*
1257812658 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
1257912659 * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet
@@ -12841,6 +12921,11 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr) · 261 unmodified lines
1284112921 return 0;
1284212922 }
1284312923
12924+static void vmx_request_immediate_exit(struct kvm_vcpu *vcpu)
12925+{
12926+ to_vmx(vcpu)->req_immediate_exit = true;
12927+}
12928+
1284412929 static u32 vmx_get_preemption_timer_value(struct kvm_vcpu *vcpu)
1284512930 {
1284612931 ktime_t remaining =
@@ -13231,12 +13316,7 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, · 384 unmodified lines
1323113316 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.host.nr);
1323213317 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr);
1323313318 vmcs_write64(TSC_OFFSET, vcpu->arch.tsc_offset);
13234− if (vmx->hv_deadline_tsc == -1)
13235− vmcs_clear_bits(PIN_BASED_VM_EXEC_CONTROL,
13236− PIN_BASED_VMX_PREEMPTION_TIMER);
13237− else
13238− vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
13239− PIN_BASED_VMX_PREEMPTION_TIMER);
13319+
1324013320 if (kvm_has_tsc_control)
1324113321 decache_tsc_multiplier(vmx);
1324213322
@@ -13440,18 +13520,12 @@ static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc) · 197 unmodified lines
1344013520 return -ERANGE;
1344113521
1344213522 vmx->hv_deadline_tsc = tscl + delta_tsc;
13443− vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL,
13444− PIN_BASED_VMX_PREEMPTION_TIMER);
13445−
1344613523 return delta_tsc == 0;
1344713524 }
1344813525
1344913526 static void vmx_cancel_hv_timer(struct kvm_vcpu *vcpu)
1345013527 {
13451− struct vcpu_vmx *vmx = to_vmx(vcpu);
13452− vmx->hv_deadline_tsc = -1;
13453− vmcs_clear_bits(PIN_BASED_VM_EXEC_CONTROL,
13454− PIN_BASED_VMX_PREEMPTION_TIMER);
13528+ to_vmx(vcpu)->hv_deadline_tsc = -1;
1345513529 }
1345613530 #endif
1345713531
@@ -13932,6 +14006,14 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, · 474 unmodified lines
1393214006 ~(KVM_STATE_NESTED_SMM_GUEST_MODE | KVM_STATE_NESTED_SMM_VMXON))
1393314007 return -EINVAL;
1393414008
14009+ /*
14010+ * SMM temporarily disables VMX, so we cannot be in guest mode,
14011+ * nor can VMLAUNCH/VMRESUME be pending. Outside SMM, SMM flags
14012+ * must be zero.
14013+ */
14014+ if (is_smm(vcpu) ? kvm_state->flags : kvm_state->vmx.smm.flags)
14015+ return -EINVAL;
14016+
1393514017 if ((kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) &&
1393614018 !(kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON))
1393714019 return -EINVAL;
@@ -13988,9 +14070,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, · 50 unmodified lines
1398814070 check_vmentry_postreqs(vcpu, vmcs12, &exit_qual))
1398914071 return -EINVAL;
1399014072
13991− if (kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING)
13992− vmx->nested.nested_run_pending = 1;
13993−
1399414073 vmx->nested.dirty_vmcs12 = true;
1399514074 ret = enter_vmx_non_root_mode(vcpu, NULL);
1399614075 if (ret)
@@ -14078,6 +14157,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { · 81 unmodified lines
1407814157 .apicv_post_state_restore = vmx_apicv_post_state_restore,
1407914158 .hwapic_irr_update = vmx_hwapic_irr_update,
1408014159 .hwapic_isr_update = vmx_hwapic_isr_update,
14160+ .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt,
1408114161 .sync_pir_to_irr = vmx_sync_pir_to_irr,
1408214162 .deliver_posted_interrupt = vmx_deliver_posted_interrupt,
1408314163
@@ -14111,6 +14191,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { · 27 unmodified lines
1411114191 .umip_emulated = vmx_umip_emulated,
1411214192
1411314193 .check_nested_events = vmx_check_nested_events,
14194+ .request_immediate_exit = vmx_request_immediate_exit,
1411414195
1411514196 .sched_in = vmx_sched_in,
1411614197
arch/x86/kvm/x86.c+88−41
@@ -628,7 +628,7 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu) · 627 unmodified lines
628628 gfn_t gfn;
629629 int r;
630630
631− if (is_long_mode(vcpu) || !is_pae(vcpu))
631+ if (is_long_mode(vcpu) || !is_pae(vcpu) || !is_paging(vcpu))
632632 return false;
633633
634634 if (!test_bit(VCPU_EXREG_PDPTR,
@@ -2537,7 +2537,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1902 unmodified lines
25372537 break;
25382538 case MSR_PLATFORM_INFO:
25392539 if (!msr_info->host_initiated ||
2540− data & ~MSR_PLATFORM_INFO_CPUID_FAULT ||
25412540 (!(data & MSR_PLATFORM_INFO_CPUID_FAULT) &&
25422541 cpuid_fault_enabled(vcpu)))
25432542 return 1;
@@ -2780,6 +2779,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 236 unmodified lines
27802779 msr_info->data = vcpu->arch.osvw.status;
27812780 break;
27822781 case MSR_PLATFORM_INFO:
2782+ if (!msr_info->host_initiated &&
2783+ !vcpu->kvm->arch.guest_can_read_msr_platform_info)
2784+ return 1;
27832785 msr_info->data = vcpu->arch.msr_platform_info;
27842786 break;
27852787 case MSR_MISC_FEATURES_ENABLES:
@@ -2927,6 +2929,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 141 unmodified lines
29272929 case KVM_CAP_SPLIT_IRQCHIP:
29282930 case KVM_CAP_IMMEDIATE_EXIT:
29292931 case KVM_CAP_GET_MSR_FEATURES:
2932+ case KVM_CAP_MSR_PLATFORM_INFO:
29302933 r = 1;
29312934 break;
29322935 case KVM_CAP_SYNC_REGS:
@@ -4007,19 +4010,23 @@ long kvm_arch_vcpu_ioctl(struct file *filp, · 1074 unmodified lines
40074010 break;
40084011
40094012 BUILD_BUG_ON(sizeof(user_data_size) != sizeof(user_kvm_nested_state->size));
4013+ r = -EFAULT;
40104014 if (get_user(user_data_size, &user_kvm_nested_state->size))
4011− return -EFAULT;
4015+ break;
40124016
40134017 r = kvm_x86_ops->get_nested_state(vcpu, user_kvm_nested_state,
40144018 user_data_size);
40154019 if (r < 0)
4016− return r;
4020+ break;
40174021
40184022 if (r > user_data_size) {
40194023 if (put_user(r, &user_kvm_nested_state->size))
4020− return -EFAULT;
4021− return -E2BIG;
4024+ r = -EFAULT;
4025+ else
4026+ r = -E2BIG;
4027+ break;
40224028 }
4029+
40234030 r = 0;
40244031 break;
40254032 }
@@ -4031,19 +4038,21 @@ long kvm_arch_vcpu_ioctl(struct file *filp, · 5 unmodified lines
40314038 if (!kvm_x86_ops->set_nested_state)
40324039 break;
40334040
4041+ r = -EFAULT;
40344042 if (copy_from_user(&kvm_state, user_kvm_nested_state, sizeof(kvm_state)))
4035− return -EFAULT;
4043+ break;
40364044
4045+ r = -EINVAL;
40374046 if (kvm_state.size < sizeof(kvm_state))
4038− return -EINVAL;
4047+ break;
40394048
40404049 if (kvm_state.flags &
40414050 ~(KVM_STATE_NESTED_RUN_PENDING | KVM_STATE_NESTED_GUEST_MODE))
4042− return -EINVAL;
4051+ break;
40434052
40444053 /* nested_run_pending implies guest_mode. */
40454054 if (kvm_state.flags == KVM_STATE_NESTED_RUN_PENDING)
4046− return -EINVAL;
4055+ break;
40474056
40484057 r = kvm_x86_ops->set_nested_state(vcpu, user_kvm_nested_state, &kvm_state);
40494058 break;
@@ -4350,6 +4359,10 @@ split_irqchip_unlock: · 300 unmodified lines
43504359 kvm->arch.pause_in_guest = true;
43514360 r = 0;
43524361 break;
4362+ case KVM_CAP_MSR_PLATFORM_INFO:
4363+ kvm->arch.guest_can_read_msr_platform_info = cap->args[0];
4364+ r = 0;
4365+ break;
43534366 default:
43544367 r = -EINVAL;
43554368 break;
@@ -4987,7 +5000,7 @@ int handle_ud(struct kvm_vcpu *vcpu) · 631 unmodified lines
49875000 emul_type = 0;
49885001 }
49895002
4990− er = emulate_instruction(vcpu, emul_type);
5003+ er = kvm_emulate_instruction(vcpu, emul_type);
49915004 if (er == EMULATE_USER_EXIT)
49925005 return 0;
49935006 if (er != EMULATE_DONE)
@@ -5870,7 +5883,10 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2, · 876 unmodified lines
58705883 gpa_t gpa = cr2;
58715884 kvm_pfn_t pfn;
58725885
5873− if (emulation_type & EMULTYPE_NO_REEXECUTE)
5886+ if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
5887+ return false;
5888+
5889+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
58745890 return false;
58755891
58765892 if (!vcpu->arch.mmu.direct_map) {
@@ -5958,7 +5974,10 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt, · 81 unmodified lines
59585974 */
59595975 vcpu->arch.last_retry_eip = vcpu->arch.last_retry_addr = 0;
59605976
5961− if (!(emulation_type & EMULTYPE_RETRY))
5977+ if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
5978+ return false;
5979+
5980+ if (WARN_ON_ONCE(is_guest_mode(vcpu)))
59625981 return false;
59635982
59645983 if (x86_page_table_writing_insn(ctxt))
@@ -6276,7 +6295,19 @@ restart: · 311 unmodified lines
62766295
62776296 return r;
62786297 }
6279−EXPORT_SYMBOL_GPL(x86_emulate_instruction);
6298+
6299+int kvm_emulate_instruction(struct kvm_vcpu *vcpu, int emulation_type)
6300+{
6301+ return x86_emulate_instruction(vcpu, 0, emulation_type, NULL, 0);
6302+}
6303+EXPORT_SYMBOL_GPL(kvm_emulate_instruction);
6304+
6305+int kvm_emulate_instruction_from_buffer(struct kvm_vcpu *vcpu,
6306+ void *insn, int insn_len)
6307+{
6308+ return x86_emulate_instruction(vcpu, 0, 0, insn, insn_len);
6309+}
6310+EXPORT_SYMBOL_GPL(kvm_emulate_instruction_from_buffer);
62806311
62816312 static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size,
62826313 unsigned short port)
@@ -7343,6 +7374,12 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) · 1060 unmodified lines
73437374 }
73447375 EXPORT_SYMBOL_GPL(kvm_vcpu_reload_apic_access_page);
73457376
7377+void __kvm_request_immediate_exit(struct kvm_vcpu *vcpu)
7378+{
7379+ smp_send_reschedule(vcpu->cpu);
7380+}
7381+EXPORT_SYMBOL_GPL(__kvm_request_immediate_exit);
7382+
73467383 /*
73477384 * Returns 1 to let vcpu_run() continue the guest execution loop without
73487385 * exiting to the userspace. Otherwise, the value will be returned to the
@@ -7547,7 +7584,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 198 unmodified lines
75477584
75487585 if (req_immediate_exit) {
75497586 kvm_make_request(KVM_REQ_EVENT, vcpu);
7550− smp_send_reschedule(vcpu->cpu);
7587+ kvm_x86_ops->request_immediate_exit(vcpu);
75517588 }
75527589
75537590 trace_kvm_entry(vcpu->vcpu_id);
@@ -7734,7 +7771,7 @@ static inline int complete_emulated_io(struct kvm_vcpu *vcpu) · 180 unmodified lines
77347771 {
77357772 int r;
77367773 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
7737− r = emulate_instruction(vcpu, EMULTYPE_NO_DECODE);
7774+ r = kvm_emulate_instruction(vcpu, EMULTYPE_NO_DECODE);
77387775 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
77397776 if (r != EMULATE_DONE)
77407777 return 0;
@@ -7811,6 +7848,29 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) · 70 unmodified lines
78117848 return 0;
78127849 }
78137850
7851+/* Swap (qemu) user FPU context for the guest FPU context. */
7852+static void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
7853+{
7854+ preempt_disable();
7855+ copy_fpregs_to_fpstate(&vcpu->arch.user_fpu);
7856+ /* PKRU is separately restored in kvm_x86_ops->run. */
7857+ __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state,
7858+ ~XFEATURE_MASK_PKRU);
7859+ preempt_enable();
7860+ trace_kvm_fpu(1);
7861+}
7862+
7863+/* When vcpu_run ends, restore user space FPU context. */
7864+static void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
7865+{
7866+ preempt_disable();
7867+ copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu);
7868+ copy_kernel_to_fpregs(&vcpu->arch.user_fpu.state);
7869+ preempt_enable();
7870+ ++vcpu->stat.fpu_reload;
7871+ trace_kvm_fpu(0);
7872+}
7873+
78147874 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
78157875 {
78167876 int r;
@@ -8159,7 +8219,7 @@ static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) · 342 unmodified lines
81598219 kvm_update_cpuid(vcpu);
81608220
81618221 idx = srcu_read_lock(&vcpu->kvm->srcu);
8162− if (!is_long_mode(vcpu) && is_pae(vcpu)) {
8222+ if (!is_long_mode(vcpu) && is_pae(vcpu) && is_paging(vcpu)) {
81638223 load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu));
81648224 mmu_reset_needed = 1;
81658225 }
@@ -8388,29 +8448,6 @@ static void fx_init(struct kvm_vcpu *vcpu) · 222 unmodified lines
83888448 vcpu->arch.cr0 |= X86_CR0_ET;
83898449 }
83908450
8391−/* Swap (qemu) user FPU context for the guest FPU context. */
8392−void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
8393−{
8394− preempt_disable();
8395− copy_fpregs_to_fpstate(&vcpu->arch.user_fpu);
8396− /* PKRU is separately restored in kvm_x86_ops->run. */
8397− __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state,
8398− ~XFEATURE_MASK_PKRU);
8399− preempt_enable();
8400− trace_kvm_fpu(1);
8401−}
8402−
8403−/* When vcpu_run ends, restore user space FPU context. */
8404−void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
8405−{
8406− preempt_disable();
8407− copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu);
8408− copy_kernel_to_fpregs(&vcpu->arch.user_fpu.state);
8409− preempt_enable();
8410− ++vcpu->stat.fpu_reload;
8411− trace_kvm_fpu(0);
8412−}
8413−
84148451 void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
84158452 {
84168453 void *wbinvd_dirty_mask = vcpu->arch.wbinvd_dirty_mask;
@@ -8834,6 +8871,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 417 unmodified lines
88348871 kvm->arch.kvmclock_offset = -ktime_get_boot_ns();
88358872 pvclock_update_vm_gtod_copy(kvm);
88368873
8874+ kvm->arch.guest_can_read_msr_platform_info = true;
8875+
88378876 INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);
88388877 INIT_DELAYED_WORK(&kvm->arch.kvmclock_sync_work, kvmclock_sync_fn);
88398878
@@ -9182,6 +9221,13 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, · 342 unmodified lines
91829221 kvm_page_track_flush_slot(kvm, slot);
91839222 }
91849223
9224+static inline bool kvm_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)
9225+{
9226+ return (is_guest_mode(vcpu) &&
9227+ kvm_x86_ops->guest_apic_has_interrupt &&
9228+ kvm_x86_ops->guest_apic_has_interrupt(vcpu));
9229+}
9230+
91859231 static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu)
91869232 {
91879233 if (!list_empty_careful(&vcpu->async_pf.done))
@@ -9206,7 +9252,8 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) · 18 unmodified lines
92069252 return true;
92079253
92089254 if (kvm_arch_interrupt_allowed(vcpu) &&
9209− kvm_cpu_has_interrupt(vcpu))
9255+ (kvm_cpu_has_interrupt(vcpu) ||
9256+ kvm_guest_apic_has_interrupt(vcpu)))
92109257 return true;
92119258
92129259 if (kvm_hv_has_stimer_pending(vcpu))
arch/x86/kvm/x86.h+2−0
@@ -274,6 +274,8 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); · 273 unmodified lines
274274 bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn,
275275 int page_num);
276276 bool kvm_vector_hashing_enabled(void);
277+int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
278+ int emulation_type, void *insn, int insn_len);
277279
278280 #define KVM_SUPPORTED_XCR0 (XFEATURE_MASK_FP | XFEATURE_MASK_SSE \
279281 | XFEATURE_MASK_YMM | XFEATURE_MASK_BNDREGS \
arch/x86/mm/init.c+4−0
@@ -815,10 +815,14 @@ void free_kernel_image_pages(void *begin, void *end) · 814 unmodified lines
815815 set_memory_np_noalias(begin_ul, len_pages);
816816 }
817817
818+void __weak mem_encrypt_free_decrypted_mem(void) { }
819+
818820 void __ref free_initmem(void)
819821 {
820822 e820__reallocate_tables();
821823
824+ mem_encrypt_free_decrypted_mem();
825+
822826 free_kernel_image_pages(&__init_begin, &__init_end);
823827 }
824828
arch/x86/mm/mem_encrypt.c+24−0
@@ -348,6 +348,30 @@ bool sev_active(void) · 347 unmodified lines
348348 EXPORT_SYMBOL(sev_active);
349349
350350 /* Architecture __weak replacement functions */
351+void __init mem_encrypt_free_decrypted_mem(void)
352+{
353+ unsigned long vaddr, vaddr_end, npages;
354+ int r;
355+
356+ vaddr = (unsigned long)__start_bss_decrypted_unused;
357+ vaddr_end = (unsigned long)__end_bss_decrypted;
358+ npages = (vaddr_end - vaddr) >> PAGE_SHIFT;
359+
360+ /*
361+ * The unused memory range was mapped decrypted, change the encryption
362+ * attribute from decrypted to encrypted before freeing it.
363+ */
364+ if (mem_encrypt_active()) {
365+ r = set_memory_encrypted(vaddr, npages);
366+ if (r) {
367+ pr_warn("failed to free unused decrypted pages\n");
368+ return;
369+ }
370+ }
371+
372+ free_init_pages("unused decrypted", vaddr, vaddr_end);
373+}
374+
351375 void __init mem_encrypt_init(void)
352376 {
353377 if (!sme_me_mask)
arch/x86/mm/pgtable.c+13−4
@@ -269,7 +269,7 @@ static void mop_up_one_pmd(struct mm_struct *mm, pgd_t *pgdp) · 268 unmodified lines
269269 if (pgd_val(pgd) != 0) {
270270 pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
271271
272− *pgdp = native_make_pgd(0);
272+ pgd_clear(pgdp);
273273
274274 paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
275275 pmd_free(mm, pmd);
@@ -494,7 +494,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, · 218 unmodified lines
494494 int changed = !pte_same(*ptep, entry);
495495
496496 if (changed && dirty)
497− *ptep = entry;
497+ set_pte(ptep, entry);
498498
499499 return changed;
500500 }
@@ -509,7 +509,7 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, · 8 unmodified lines
509509 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
510510
511511 if (changed && dirty) {
512− *pmdp = entry;
512+ set_pmd(pmdp, entry);
513513 /*
514514 * We had a write-protection fault here and changed the pmd
515515 * to to more permissive. No need to flush the TLB for that,
@@ -529,7 +529,7 @@ int pudp_set_access_flags(struct vm_area_struct *vma, unsigned long address, · 13 unmodified lines
529529 VM_BUG_ON(address & ~HPAGE_PUD_MASK);
530530
531531 if (changed && dirty) {
532− *pudp = entry;
532+ set_pud(pudp, entry);
533533 /*
534534 * We had a write-protection fault here and changed the pud
535535 * to to more permissive. No need to flush the TLB for that,
@@ -637,6 +637,15 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) · 101 unmodified lines
637637 {
638638 unsigned long address = __fix_to_virt(idx);
639639
640+#ifdef CONFIG_X86_64
641+ /*
642+ * Ensure that the static initial page tables are covering the
643+ * fixmap completely.
644+ */
645+ BUILD_BUG_ON(__end_of_permanent_fixed_addresses >
646+ (FIXMAP_PMD_NUM * PTRS_PER_PTE));
647+#endif
648+
640649 if (idx >= __end_of_fixed_addresses) {
641650 BUG();
642651 return;
arch/x86/platform/efi/efi_32.c+1−2
@@ -85,10 +85,9 @@ pgd_t * __init efi_call_phys_prolog(void) · 84 unmodified lines
8585
8686 void __init efi_call_phys_epilog(pgd_t *save_pgd)
8787 {
88+ load_fixmap_gdt(0);
8889 load_cr3(save_pgd);
8990 __flush_tlb_all();
90−
91− load_fixmap_gdt(0);
9291 }
9392
9493 void __init efi_runtime_update_mappings(void)
arch/x86/xen/mmu_pv.c+6−2
@@ -1907,7 +1907,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) · 1906 unmodified lines
19071907 /* L3_k[511] -> level2_fixmap_pgt */
19081908 convert_pfn_mfn(level3_kernel_pgt);
19091909
1910− /* L3_k[511][506] -> level1_fixmap_pgt */
1910+ /* L3_k[511][508-FIXMAP_PMD_NUM ... 507] -> level1_fixmap_pgt */
19111911 convert_pfn_mfn(level2_fixmap_pgt);
19121912
19131913 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
@@ -1952,7 +1952,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) · 38 unmodified lines
19521952 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
19531953 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
19541954 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
1955− set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
1955+
1956+ for (i = 0; i < FIXMAP_PMD_NUM; i++) {
1957+ set_page_prot(level1_fixmap_pgt + i * PTRS_PER_PTE,
1958+ PAGE_KERNEL_RO);
1959+ }
19561960
19571961 /* Pin down new L4 */
19581962 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
arch/x86/xen/pmu.c+1−1
@@ -479,7 +479,7 @@ static void xen_convert_regs(const struct xen_pmu_regs *xen_regs, · 478 unmodified lines
479479 irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)
480480 {
481481 int err, ret = IRQ_NONE;
482− struct pt_regs regs;
482+ struct pt_regs regs = {0};
483483 const struct xen_pmu_data *xenpmu_data = get_xenpmu_data();
484484 uint8_t xenpmu_flags = get_xenpmu_flags();
485485
arch/xtensa/Kconfig+1−0
@@ -4,6 +4,7 @@ config ZONE_DMA · 3 unmodified lines
44
55 config XTENSA
66 def_bool y
7+ select ARCH_HAS_SG_CHAIN
78 select ARCH_HAS_SYNC_DMA_FOR_CPU
89 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
910 select ARCH_NO_COHERENT_DMA_MMAP if !MMU
arch/xtensa/Makefile+0−4
@@ -64,11 +64,7 @@ endif · 63 unmodified lines
6464 vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
6565 plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
6666
67−ifeq ($(KBUILD_SRC),)
68−KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
69−else
7067 KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
71−endif
7268
7369 KBUILD_DEFCONFIG := iss_defconfig
7470
arch/xtensa/platforms/iss/setup.c+15−10
@@ -78,23 +78,28 @@ static struct notifier_block iss_panic_block = { · 77 unmodified lines
7878
7979 void __init platform_setup(char **p_cmdline)
8080 {
81+ static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
82+ static char cmdline[COMMAND_LINE_SIZE] __initdata;
8183 int argc = simc_argc();
8284 int argv_size = simc_argv_size();
8385
8486 if (argc > 1) {
85− void **argv = alloc_bootmem(argv_size);
86− char *cmdline = alloc_bootmem(argv_size);
87− int i;
87+ if (argv_size > sizeof(argv)) {
88+ pr_err("%s: command line too long: argv_size = %d\n",
89+ __func__, argv_size);
90+ } else {
91+ int i;
8892
89− cmdline[0] = 0;
90− simc_argv((void *)argv);
93+ cmdline[0] = 0;
94+ simc_argv((void *)argv);
9195
92− for (i = 1; i < argc; ++i) {
93− if (i > 1)
94− strcat(cmdline, " ");
95− strcat(cmdline, argv[i]);
96+ for (i = 1; i < argc; ++i) {
97+ if (i > 1)
98+ strcat(cmdline, " ");
99+ strcat(cmdline, argv[i]);
100+ }
101+ *p_cmdline = cmdline;
96102 }
97− *p_cmdline = cmdline;
98103 }
99104
100105 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
block/bio.c+1−1
@@ -1685,7 +1685,7 @@ void generic_end_io_acct(struct request_queue *q, int req_op, · 1684 unmodified lines
16851685 const int sgrp = op_stat_group(req_op);
16861686 int cpu = part_stat_lock();
16871687
1688− part_stat_add(cpu, part, ticks[sgrp], duration);
1688+ part_stat_add(cpu, part, nsecs[sgrp], jiffies_to_nsecs(duration));
16891689 part_round_stats(q, cpu, part);
16901690 part_dec_in_flight(q, part, op_is_write(req_op));
16911691
block/blk-cgroup.c+3−1
@@ -1558,8 +1558,10 @@ int blkcg_policy_register(struct blkcg_policy *pol) · 1557 unmodified lines
15581558 for (i = 0; i < BLKCG_MAX_POLS; i++)
15591559 if (!blkcg_policy[i])
15601560 break;
1561− if (i >= BLKCG_MAX_POLS)
1561+ if (i >= BLKCG_MAX_POLS) {
1562+ pr_warn("blkcg_policy_register: BLKCG_MAX_POLS too small\n");
15621563 goto err_unlock;
1564+ }
15631565
15641566 /* Make sure cpd/pd_alloc_fn and cpd/pd_free_fn in pairs */
15651567 if ((!pol->cpd_alloc_fn ^ !pol->cpd_free_fn) ||
block/blk-core.c+1−3
@@ -2727,17 +2727,15 @@ void blk_account_io_done(struct request *req, u64 now) · 2726 unmodified lines
27272727 * containing request is enough.
27282728 */
27292729 if (blk_do_io_stat(req) && !(req->rq_flags & RQF_FLUSH_SEQ)) {
2730− unsigned long duration;
27312730 const int sgrp = op_stat_group(req_op(req));
27322731 struct hd_struct *part;
27332732 int cpu;
27342733
2735− duration = nsecs_to_jiffies(now - req->start_time_ns);
27362734 cpu = part_stat_lock();
27372735 part = req->part;
27382736
27392737 part_stat_inc(cpu, part, ios[sgrp]);
2740− part_stat_add(cpu, part, ticks[sgrp], duration);
2738+ part_stat_add(cpu, part, nsecs[sgrp], now - req->start_time_ns);
27412739 part_round_stats(req->q, cpu, part);
27422740 part_dec_in_flight(req->q, part, rq_data_dir(req));
27432741
block/blk-mq-tag.c+2−5
@@ -384,11 +384,8 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn, · 383 unmodified lines
384384 * synchronize_rcu() to ensure this function left the critical section
385385 * below.
386386 */
387− rcu_read_lock();
388− if (percpu_ref_is_zero(&q->q_usage_counter)) {
389− rcu_read_unlock();
387+ if (!percpu_ref_tryget(&q->q_usage_counter))
390388 return;
391− }
392389
393390 queue_for_each_hw_ctx(q, hctx, i) {
394391 struct blk_mq_tags *tags = hctx->tags;
@@ -404,7 +401,7 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn, · 9 unmodified lines
404401 bt_for_each(hctx, &tags->breserved_tags, fn, priv, true);
405402 bt_for_each(hctx, &tags->bitmap_tags, fn, priv, false);
406403 }
407− rcu_read_unlock();
404+ blk_queue_exit(q);
408405 }
409406
410407 static int bt_alloc(struct sbitmap_queue *bt, unsigned int depth,
block/blk-mq.c+2−2
@@ -1631,7 +1631,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) · 1630 unmodified lines
16311631 BUG_ON(!rq->q);
16321632 if (rq->mq_ctx != this_ctx) {
16331633 if (this_ctx) {
1634− trace_block_unplug(this_q, depth, from_schedule);
1634+ trace_block_unplug(this_q, depth, !from_schedule);
16351635 blk_mq_sched_insert_requests(this_q, this_ctx,
16361636 &ctx_list,
16371637 from_schedule);
@@ -1651,7 +1651,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) · 13 unmodified lines
16511651 * on 'ctx_list'. Do those.
16521652 */
16531653 if (this_ctx) {
1654− trace_block_unplug(this_q, depth, from_schedule);
1654+ trace_block_unplug(this_q, depth, !from_schedule);
16551655 blk_mq_sched_insert_requests(this_q, this_ctx, &ctx_list,
16561656 from_schedule);
16571657 }
block/elevator.c+1−1
@@ -589,7 +589,7 @@ void elv_drain_elevator(struct request_queue *q) · 588 unmodified lines
589589
590590 while (e->type->ops.sq.elevator_dispatch_fn(q, 1))
591591 ;
592− if (q->nr_sorted && printed++ < 10) {
592+ if (q->nr_sorted && !blk_queue_is_zoned(q) && printed++ < 10 ) {
593593 printk(KERN_ERR "%s: forced dispatching is broken "
594594 "(nr_sorted=%u), please report this\n",
595595 q->elevator->type->elevator_name, q->nr_sorted);
block/genhd.c+3−3
@@ -1352,18 +1352,18 @@ static int diskstats_show(struct seq_file *seqf, void *v) · 1351 unmodified lines
13521352 part_stat_read(hd, ios[STAT_READ]),
13531353 part_stat_read(hd, merges[STAT_READ]),
13541354 part_stat_read(hd, sectors[STAT_READ]),
1355− jiffies_to_msecs(part_stat_read(hd, ticks[STAT_READ])),
1355+ (unsigned int)part_stat_read_msecs(hd, STAT_READ),
13561356 part_stat_read(hd, ios[STAT_WRITE]),
13571357 part_stat_read(hd, merges[STAT_WRITE]),
13581358 part_stat_read(hd, sectors[STAT_WRITE]),
1359− jiffies_to_msecs(part_stat_read(hd, ticks[STAT_WRITE])),
1359+ (unsigned int)part_stat_read_msecs(hd, STAT_WRITE),
13601360 inflight[0],
13611361 jiffies_to_msecs(part_stat_read(hd, io_ticks)),
13621362 jiffies_to_msecs(part_stat_read(hd, time_in_queue)),
13631363 part_stat_read(hd, ios[STAT_DISCARD]),
13641364 part_stat_read(hd, merges[STAT_DISCARD]),
13651365 part_stat_read(hd, sectors[STAT_DISCARD]),
1366− jiffies_to_msecs(part_stat_read(hd, ticks[STAT_DISCARD]))
1366+ (unsigned int)part_stat_read_msecs(hd, STAT_DISCARD)
13671367 );
13681368 }
13691369 disk_part_iter_exit(&piter);
block/partition-generic.c+3−3
@@ -136,18 +136,18 @@ ssize_t part_stat_show(struct device *dev, · 135 unmodified lines
136136 part_stat_read(p, ios[STAT_READ]),
137137 part_stat_read(p, merges[STAT_READ]),
138138 (unsigned long long)part_stat_read(p, sectors[STAT_READ]),
139− jiffies_to_msecs(part_stat_read(p, ticks[STAT_READ])),
139+ (unsigned int)part_stat_read_msecs(p, STAT_READ),
140140 part_stat_read(p, ios[STAT_WRITE]),
141141 part_stat_read(p, merges[STAT_WRITE]),
142142 (unsigned long long)part_stat_read(p, sectors[STAT_WRITE]),
143− jiffies_to_msecs(part_stat_read(p, ticks[STAT_WRITE])),
143+ (unsigned int)part_stat_read_msecs(p, STAT_WRITE),
144144 inflight[0],
145145 jiffies_to_msecs(part_stat_read(p, io_ticks)),
146146 jiffies_to_msecs(part_stat_read(p, time_in_queue)),
147147 part_stat_read(p, ios[STAT_DISCARD]),
148148 part_stat_read(p, merges[STAT_DISCARD]),
149149 (unsigned long long)part_stat_read(p, sectors[STAT_DISCARD]),
150− jiffies_to_msecs(part_stat_read(p, ticks[STAT_DISCARD])));
150+ (unsigned int)part_stat_read_msecs(p, STAT_DISCARD));
151151 }
152152
153153 ssize_t part_inflight_show(struct device *dev, struct device_attribute *attr,
drivers/acpi/acpi_lpss.c+1−1
@@ -879,7 +879,7 @@ static void acpi_lpss_dismiss(struct device *dev) · 878 unmodified lines
879879 #define LPSS_GPIODEF0_DMA_LLP BIT(13)
880880
881881 static DEFINE_MUTEX(lpss_iosf_mutex);
882−static bool lpss_iosf_d3_entered;
882+static bool lpss_iosf_d3_entered = true;
883883
884884 static void lpss_iosf_enter_d3_state(void)
885885 {
drivers/acpi/bus.c+7−6
@@ -35,11 +35,11 @@ · 34 unmodified lines
3535 #include <linux/delay.h>
3636 #ifdef CONFIG_X86
3737 #include <asm/mpspec.h>
38+#include <linux/dmi.h>
3839 #endif
3940 #include <linux/acpi_iort.h>
4041 #include <linux/pci.h>
4142 #include <acpi/apei.h>
42−#include <linux/dmi.h>
4343 #include <linux/suspend.h>
4444
4545 #include "internal.h"
@@ -82,10 +82,6 @@ static const struct dmi_system_id dsdt_dmi_table[] __initconst = { · 36 unmodified lines
8282 },
8383 {}
8484 };
85−#else
86−static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
87− {}
88−};
8985 #endif
9086
9187 /* --------------------------------------------------------------------------
@@ -1033,11 +1029,16 @@ void __init acpi_early_init(void) · 941 unmodified lines
10331029
10341030 acpi_permanent_mmap = true;
10351031
1032+#ifdef CONFIG_X86
10361033 /*
10371034 * If the machine falls into the DMI check table,
1038− * DSDT will be copied to memory
1035+ * DSDT will be copied to memory.
1036+ * Note that calling dmi_check_system() here on other architectures
1037+ * would not be OK because only x86 initializes dmi early enough.
1038+ * Thankfully only x86 systems need such quirks for now.
10391039 */
10401040 dmi_check_system(dsdt_dmi_table);
1041+#endif
10411042
10421043 status = acpi_reallocate_root_table();
10431044 if (ACPI_FAILURE(status)) {
drivers/android/binder_alloc.c+35−8
@@ -332,6 +332,35 @@ err_no_vma: · 331 unmodified lines
332332 return vma ? -ENOMEM : -ESRCH;
333333 }
334334
335+
336+static inline void binder_alloc_set_vma(struct binder_alloc *alloc,
337+ struct vm_area_struct *vma)
338+{
339+ if (vma)
340+ alloc->vma_vm_mm = vma->vm_mm;
341+ /*
342+ * If we see alloc->vma is not NULL, buffer data structures set up
343+ * completely. Look at smp_rmb side binder_alloc_get_vma.
344+ * We also want to guarantee new alloc->vma_vm_mm is always visible
345+ * if alloc->vma is set.
346+ */
347+ smp_wmb();
348+ alloc->vma = vma;
349+}
350+
351+static inline struct vm_area_struct *binder_alloc_get_vma(
352+ struct binder_alloc *alloc)
353+{
354+ struct vm_area_struct *vma = NULL;
355+
356+ if (alloc->vma) {
357+ /* Look at description in binder_alloc_set_vma */
358+ smp_rmb();
359+ vma = alloc->vma;
360+ }
361+ return vma;
362+}
363+
335364 static struct binder_buffer *binder_alloc_new_buf_locked(
336365 struct binder_alloc *alloc,
337366 size_t data_size,
@@ -348,7 +377,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked( · 10 unmodified lines
348377 size_t size, data_offsets_size;
349378 int ret;
350379
351− if (alloc->vma == NULL) {
380+ if (!binder_alloc_get_vma(alloc)) {
352381 binder_alloc_debug(BINDER_DEBUG_USER_ERROR,
353382 "%d: binder_alloc_buf, no vma\n",
354383 alloc->pid);
@@ -723,9 +752,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, · 368 unmodified lines
723752 buffer->free = 1;
724753 binder_insert_free_buffer(alloc, buffer);
725754 alloc->free_async_space = alloc->buffer_size / 2;
726− barrier();
727− alloc->vma = vma;
728− alloc->vma_vm_mm = vma->vm_mm;
755+ binder_alloc_set_vma(alloc, vma);
729756 mmgrab(alloc->vma_vm_mm);
730757
731758 return 0;
@@ -754,10 +781,10 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc) · 22 unmodified lines
754781 int buffers, page_count;
755782 struct binder_buffer *buffer;
756783
757− BUG_ON(alloc->vma);
758−
759784 buffers = 0;
760785 mutex_lock(&alloc->mutex);
786+ BUG_ON(alloc->vma);
787+
761788 while ((n = rb_first(&alloc->allocated_buffers))) {
762789 buffer = rb_entry(n, struct binder_buffer, rb_node);
763790
@@ -900,7 +927,7 @@ int binder_alloc_get_allocated_count(struct binder_alloc *alloc) · 136 unmodified lines
900927 */
901928 void binder_alloc_vma_close(struct binder_alloc *alloc)
902929 {
903− WRITE_ONCE(alloc->vma, NULL);
930+ binder_alloc_set_vma(alloc, NULL);
904931 }
905932
906933 /**
@@ -935,7 +962,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item, · 28 unmodified lines
935962
936963 index = page - alloc->pages;
937964 page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE;
938− vma = alloc->vma;
965+ vma = binder_alloc_get_vma(alloc);
939966 if (vma) {
940967 if (!mmget_not_zero(alloc->vma_vm_mm))
941968 goto err_mmget;
drivers/ata/libata-core.c+12−2
@@ -5359,10 +5359,20 @@ void ata_qc_complete(struct ata_queued_cmd *qc) · 5358 unmodified lines
53595359 */
53605360 int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active)
53615361 {
5362+ u64 done_mask, ap_qc_active = ap->qc_active;
53625363 int nr_done = 0;
5363− u64 done_mask;
53645364
5365− done_mask = ap->qc_active ^ qc_active;
5365+ /*
5366+ * If the internal tag is set on ap->qc_active, then we care about
5367+ * bit0 on the passed in qc_active mask. Move that bit up to match
5368+ * the internal tag.
5369+ */
5370+ if (ap_qc_active & (1ULL << ATA_TAG_INTERNAL)) {
5371+ qc_active |= (qc_active & 0x01) << ATA_TAG_INTERNAL;
5372+ qc_active ^= qc_active & 0x01;
5373+ }
5374+
5375+ done_mask = ap_qc_active ^ qc_active;
53665376
53675377 if (unlikely(done_mask & qc_active)) {
53685378 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n",
drivers/base/firmware_loader/main.c+18−12
@@ -209,21 +209,24 @@ static struct fw_priv *__lookup_fw_priv(const char *fw_name) · 208 unmodified lines
209209 static int alloc_lookup_fw_priv(const char *fw_name,
210210 struct firmware_cache *fwc,
211211 struct fw_priv **fw_priv, void *dbuf,
212− size_t size)
212+ size_t size, enum fw_opt opt_flags)
213213 {
214214 struct fw_priv *tmp;
215215
216216 spin_lock(&fwc->lock);
217− tmp = __lookup_fw_priv(fw_name);
218− if (tmp) {
219− kref_get(&tmp->ref);
220− spin_unlock(&fwc->lock);
221− *fw_priv = tmp;
222− pr_debug("batched request - sharing the same struct fw_priv and lookup for multiple requests\n");
223− return 1;
217+ if (!(opt_flags & FW_OPT_NOCACHE)) {
218+ tmp = __lookup_fw_priv(fw_name);
219+ if (tmp) {
220+ kref_get(&tmp->ref);
221+ spin_unlock(&fwc->lock);
222+ *fw_priv = tmp;
223+ pr_debug("batched request - sharing the same struct fw_priv and lookup for multiple requests\n");
224+ return 1;
225+ }
224226 }
227+
225228 tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
226− if (tmp)
229+ if (tmp && !(opt_flags & FW_OPT_NOCACHE))
227230 list_add(&tmp->list, &fwc->head);
228231 spin_unlock(&fwc->lock);
229232
@@ -493,7 +496,8 @@ int assign_fw(struct firmware *fw, struct device *device, · 263 unmodified lines
493496 */
494497 static int
495498 _request_firmware_prepare(struct firmware **firmware_p, const char *name,
496− struct device *device, void *dbuf, size_t size)
499+ struct device *device, void *dbuf, size_t size,
500+ enum fw_opt opt_flags)
497501 {
498502 struct firmware *firmware;
499503 struct fw_priv *fw_priv;
@@ -511,7 +515,8 @@ _request_firmware_prepare(struct firmware **firmware_p, const char *name, · 11 unmodified lines
511515 return 0; /* assigned */
512516 }
513517
514− ret = alloc_lookup_fw_priv(name, &fw_cache, &fw_priv, dbuf, size);
518+ ret = alloc_lookup_fw_priv(name, &fw_cache, &fw_priv, dbuf, size,
519+ opt_flags);
515520
516521 /*
517522 * bind with 'priv' now to avoid warning in failure path
@@ -571,7 +576,8 @@ _request_firmware(const struct firmware **firmware_p, const char *name, · 53 unmodified lines
571576 goto out;
572577 }
573578
574− ret = _request_firmware_prepare(&fw, name, device, buf, size);
579+ ret = _request_firmware_prepare(&fw, name, device, buf, size,
580+ opt_flags);
575581 if (ret <= 0) /* error or already assigned */
576582 goto out;
577583
drivers/block/floppy.c+3−0
@@ -3467,6 +3467,9 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int · 3466 unmodified lines
34673467 (struct floppy_struct **)&outparam);
34683468 if (ret)
34693469 return ret;
3470+ memcpy(&inparam.g, outparam,
3471+ offsetof(struct floppy_struct, name));
3472+ outparam = &inparam.g;
34703473 break;
34713474 case FDMSGON:
34723475 UDP->flags |= FTD_MSG;
drivers/block/null_blk.h+10−7
@@ -87,10 +87,10 @@ struct nullb { · 86 unmodified lines
8787 #ifdef CONFIG_BLK_DEV_ZONED
8888 int null_zone_init(struct nullb_device *dev);
8989 void null_zone_exit(struct nullb_device *dev);
90−blk_status_t null_zone_report(struct nullb *nullb,
91− struct nullb_cmd *cmd);
92−void null_zone_write(struct nullb_cmd *cmd);
93−void null_zone_reset(struct nullb_cmd *cmd);
90+blk_status_t null_zone_report(struct nullb *nullb, struct bio *bio);
91+void null_zone_write(struct nullb_cmd *cmd, sector_t sector,
92+ unsigned int nr_sectors);
93+void null_zone_reset(struct nullb_cmd *cmd, sector_t sector);
9494 #else
9595 static inline int null_zone_init(struct nullb_device *dev)
9696 {
@@ -98,11 +98,14 @@ static inline int null_zone_init(struct nullb_device *dev) · 1 unmodified line
9898 }
9999 static inline void null_zone_exit(struct nullb_device *dev) {}
100100 static inline blk_status_t null_zone_report(struct nullb *nullb,
101− struct nullb_cmd *cmd)
101+ struct bio *bio)
102102 {
103103 return BLK_STS_NOTSUPP;
104104 }
105−static inline void null_zone_write(struct nullb_cmd *cmd) {}
106−static inline void null_zone_reset(struct nullb_cmd *cmd) {}
105+static inline void null_zone_write(struct nullb_cmd *cmd, sector_t sector,
106+ unsigned int nr_sectors)
107+{
108+}
109+static inline void null_zone_reset(struct nullb_cmd *cmd, sector_t sector) {}
107110 #endif /* CONFIG_BLK_DEV_ZONED */
108111 #endif /* __NULL_BLK_H */
drivers/block/null_blk_main.c+38−7
@@ -1157,16 +1157,33 @@ static void null_restart_queue_async(struct nullb *nullb) · 1156 unmodified lines
11571157 }
11581158 }
11591159
1160+static bool cmd_report_zone(struct nullb *nullb, struct nullb_cmd *cmd)
1161+{
1162+ struct nullb_device *dev = cmd->nq->dev;
1163+
1164+ if (dev->queue_mode == NULL_Q_BIO) {
1165+ if (bio_op(cmd->bio) == REQ_OP_ZONE_REPORT) {
1166+ cmd->error = null_zone_report(nullb, cmd->bio);
1167+ return true;
1168+ }
1169+ } else {
1170+ if (req_op(cmd->rq) == REQ_OP_ZONE_REPORT) {
1171+ cmd->error = null_zone_report(nullb, cmd->rq->bio);
1172+ return true;
1173+ }
1174+ }
1175+
1176+ return false;
1177+}
1178+
11601179 static blk_status_t null_handle_cmd(struct nullb_cmd *cmd)
11611180 {
11621181 struct nullb_device *dev = cmd->nq->dev;
11631182 struct nullb *nullb = dev->nullb;
11641183 int err = 0;
11651184
1166− if (req_op(cmd->rq) == REQ_OP_ZONE_REPORT) {
1167− cmd->error = null_zone_report(nullb, cmd);
1185+ if (cmd_report_zone(nullb, cmd))
11681186 goto out;
1169− }
11701187
11711188 if (test_bit(NULLB_DEV_FL_THROTTLED, &dev->flags)) {
11721189 struct request *rq = cmd->rq;
@@ -1234,10 +1251,24 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd) · 61 unmodified lines
12341251 cmd->error = errno_to_blk_status(err);
12351252
12361253 if (!cmd->error && dev->zoned) {
1237− if (req_op(cmd->rq) == REQ_OP_WRITE)
1238− null_zone_write(cmd);
1239− else if (req_op(cmd->rq) == REQ_OP_ZONE_RESET)
1240− null_zone_reset(cmd);
1254+ sector_t sector;
1255+ unsigned int nr_sectors;
1256+ int op;
1257+
1258+ if (dev->queue_mode == NULL_Q_BIO) {
1259+ op = bio_op(cmd->bio);
1260+ sector = cmd->bio->bi_iter.bi_sector;
1261+ nr_sectors = cmd->bio->bi_iter.bi_size >> 9;
1262+ } else {
1263+ op = req_op(cmd->rq);
1264+ sector = blk_rq_pos(cmd->rq);
1265+ nr_sectors = blk_rq_sectors(cmd->rq);
1266+ }
1267+
1268+ if (op == REQ_OP_WRITE)
1269+ null_zone_write(cmd, sector, nr_sectors);
1270+ else if (op == REQ_OP_ZONE_RESET)
1271+ null_zone_reset(cmd, sector);
12411272 }
12421273 out:
12431274 /* Complete IO by inline, softirq or timer */
drivers/block/null_blk_zoned.c+14−20
@@ -48,8 +48,8 @@ void null_zone_exit(struct nullb_device *dev) · 47 unmodified lines
4848 kvfree(dev->zones);
4949 }
5050
51−static void null_zone_fill_rq(struct nullb_device *dev, struct request *rq,
52− unsigned int zno, unsigned int nr_zones)
51+static void null_zone_fill_bio(struct nullb_device *dev, struct bio *bio,
52+ unsigned int zno, unsigned int nr_zones)
5353 {
5454 struct blk_zone_report_hdr *hdr = NULL;
5555 struct bio_vec bvec;
@@ -57,7 +57,7 @@ static void null_zone_fill_rq(struct nullb_device *dev, struct request *rq, · 1 unmodified line
5757 void *addr;
5858 unsigned int zones_to_cpy;
5959
60− bio_for_each_segment(bvec, rq->bio, iter) {
60+ bio_for_each_segment(bvec, bio, iter) {
6161 addr = kmap_atomic(bvec.bv_page);
6262
6363 zones_to_cpy = bvec.bv_len / sizeof(struct blk_zone);
@@ -84,29 +84,24 @@ static void null_zone_fill_rq(struct nullb_device *dev, struct request *rq, · 20 unmodified lines
8484 }
8585 }
8686
87−blk_status_t null_zone_report(struct nullb *nullb,
88− struct nullb_cmd *cmd)
87+blk_status_t null_zone_report(struct nullb *nullb, struct bio *bio)
8988 {
9089 struct nullb_device *dev = nullb->dev;
91− struct request *rq = cmd->rq;
92− unsigned int zno = null_zone_no(dev, blk_rq_pos(rq));
90+ unsigned int zno = null_zone_no(dev, bio->bi_iter.bi_sector);
9391 unsigned int nr_zones = dev->nr_zones - zno;
94− unsigned int max_zones = (blk_rq_bytes(rq) /
95− sizeof(struct blk_zone)) - 1;
92+ unsigned int max_zones;
9693
94+ max_zones = (bio->bi_iter.bi_size / sizeof(struct blk_zone)) - 1;
9795 nr_zones = min_t(unsigned int, nr_zones, max_zones);
98−
99− null_zone_fill_rq(nullb->dev, rq, zno, nr_zones);
96+ null_zone_fill_bio(nullb->dev, bio, zno, nr_zones);
10097
10198 return BLK_STS_OK;
10299 }
103100
104−void null_zone_write(struct nullb_cmd *cmd)
101+void null_zone_write(struct nullb_cmd *cmd, sector_t sector,
102+ unsigned int nr_sectors)
105103 {
106104 struct nullb_device *dev = cmd->nq->dev;
107− struct request *rq = cmd->rq;
108− sector_t sector = blk_rq_pos(rq);
109− unsigned int rq_sectors = blk_rq_sectors(rq);
110105 unsigned int zno = null_zone_no(dev, sector);
111106 struct blk_zone *zone = &dev->zones[zno];
112107
@@ -118,7 +113,7 @@ void null_zone_write(struct nullb_cmd *cmd) · 5 unmodified lines
118113 case BLK_ZONE_COND_EMPTY:
119114 case BLK_ZONE_COND_IMP_OPEN:
120115 /* Writes must be at the write pointer position */
121− if (blk_rq_pos(rq) != zone->wp) {
116+ if (sector != zone->wp) {
122117 cmd->error = BLK_STS_IOERR;
123118 break;
124119 }
@@ -126,7 +121,7 @@ void null_zone_write(struct nullb_cmd *cmd) · 1 unmodified line
126121 if (zone->cond == BLK_ZONE_COND_EMPTY)
127122 zone->cond = BLK_ZONE_COND_IMP_OPEN;
128123
129− zone->wp += rq_sectors;
124+ zone->wp += nr_sectors;
130125 if (zone->wp == zone->start + zone->len)
131126 zone->cond = BLK_ZONE_COND_FULL;
132127 break;
@@ -137,11 +132,10 @@ void null_zone_write(struct nullb_cmd *cmd) · 4 unmodified lines
137132 }
138133 }
139134
140−void null_zone_reset(struct nullb_cmd *cmd)
135+void null_zone_reset(struct nullb_cmd *cmd, sector_t sector)
141136 {
142137 struct nullb_device *dev = cmd->nq->dev;
143− struct request *rq = cmd->rq;
144− unsigned int zno = null_zone_no(dev, blk_rq_pos(rq));
138+ unsigned int zno = null_zone_no(dev, sector);
145139 struct blk_zone *zone = &dev->zones[zno];
146140
147141 zone->cond = BLK_ZONE_COND_EMPTY;
drivers/block/rbd.c+178−57
@@ -4207,11 +4207,13 @@ static ssize_t rbd_parent_show(struct device *dev, · 4206 unmodified lines
42074207
42084208 count += sprintf(&buf[count], "%s"
42094209 "pool_id %llu\npool_name %s\n"
4210+ "pool_ns %s\n"
42104211 "image_id %s\nimage_name %s\n"
42114212 "snap_id %llu\nsnap_name %s\n"
42124213 "overlap %llu\n",
42134214 !count ? "" : "\n", /* first? */
42144215 spec->pool_id, spec->pool_name,
4216+ spec->pool_ns ?: "",
42154217 spec->image_id, spec->image_name ?: "(unknown)",
42164218 spec->snap_id, spec->snap_name,
42174219 rbd_dev->parent_overlap);
@@ -4584,47 +4586,177 @@ static int rbd_dev_v2_features(struct rbd_device *rbd_dev) · 366 unmodified lines
45844586 &rbd_dev->header.features);
45854587 }
45864588
4589+struct parent_image_info {
4590+ u64 pool_id;
4591+ const char *pool_ns;
4592+ const char *image_id;
4593+ u64 snap_id;
4594+
4595+ bool has_overlap;
4596+ u64 overlap;
4597+};
4598+
4599+/*
4600+ * The caller is responsible for @pii.
4601+ */
4602+static int decode_parent_image_spec(void **p, void *end,
4603+ struct parent_image_info *pii)
4604+{
4605+ u8 struct_v;
4606+ u32 struct_len;
4607+ int ret;
4608+
4609+ ret = ceph_start_decoding(p, end, 1, "ParentImageSpec",
4610+ &struct_v, &struct_len);
4611+ if (ret)
4612+ return ret;
4613+
4614+ ceph_decode_64_safe(p, end, pii->pool_id, e_inval);
4615+ pii->pool_ns = ceph_extract_encoded_string(p, end, NULL, GFP_KERNEL);
4616+ if (IS_ERR(pii->pool_ns)) {
4617+ ret = PTR_ERR(pii->pool_ns);
4618+ pii->pool_ns = NULL;
4619+ return ret;
4620+ }
4621+ pii->image_id = ceph_extract_encoded_string(p, end, NULL, GFP_KERNEL);
4622+ if (IS_ERR(pii->image_id)) {
4623+ ret = PTR_ERR(pii->image_id);
4624+ pii->image_id = NULL;
4625+ return ret;
4626+ }
4627+ ceph_decode_64_safe(p, end, pii->snap_id, e_inval);
4628+ return 0;
4629+
4630+e_inval:
4631+ return -EINVAL;
4632+}
4633+
4634+static int __get_parent_info(struct rbd_device *rbd_dev,
4635+ struct page *req_page,
4636+ struct page *reply_page,
4637+ struct parent_image_info *pii)
4638+{
4639+ struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
4640+ size_t reply_len = PAGE_SIZE;
4641+ void *p, *end;
4642+ int ret;
4643+
4644+ ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc,
4645+ "rbd", "parent_get", CEPH_OSD_FLAG_READ,
4646+ req_page, sizeof(u64), reply_page, &reply_len);
4647+ if (ret)
4648+ return ret == -EOPNOTSUPP ? 1 : ret;
4649+
4650+ p = page_address(reply_page);
4651+ end = p + reply_len;
4652+ ret = decode_parent_image_spec(&p, end, pii);
4653+ if (ret)
4654+ return ret;
4655+
4656+ ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc,
4657+ "rbd", "parent_overlap_get", CEPH_OSD_FLAG_READ,
4658+ req_page, sizeof(u64), reply_page, &reply_len);
4659+ if (ret)
4660+ return ret;
4661+
4662+ p = page_address(reply_page);
4663+ end = p + reply_len;
4664+ ceph_decode_8_safe(&p, end, pii->has_overlap, e_inval);
4665+ if (pii->has_overlap)
4666+ ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
4667+
4668+ return 0;
4669+
4670+e_inval:
4671+ return -EINVAL;
4672+}
4673+
4674+/*
4675+ * The caller is responsible for @pii.
4676+ */
4677+static int __get_parent_info_legacy(struct rbd_device *rbd_dev,
4678+ struct page *req_page,
4679+ struct page *reply_page,
4680+ struct parent_image_info *pii)
4681+{
4682+ struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
4683+ size_t reply_len = PAGE_SIZE;
4684+ void *p, *end;
4685+ int ret;
4686+
4687+ ret = ceph_osdc_call(osdc, &rbd_dev->header_oid, &rbd_dev->header_oloc,
4688+ "rbd", "get_parent", CEPH_OSD_FLAG_READ,
4689+ req_page, sizeof(u64), reply_page, &reply_len);
4690+ if (ret)
4691+ return ret;
4692+
4693+ p = page_address(reply_page);
4694+ end = p + reply_len;
4695+ ceph_decode_64_safe(&p, end, pii->pool_id, e_inval);
4696+ pii->image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL);
4697+ if (IS_ERR(pii->image_id)) {
4698+ ret = PTR_ERR(pii->image_id);
4699+ pii->image_id = NULL;
4700+ return ret;
4701+ }
4702+ ceph_decode_64_safe(&p, end, pii->snap_id, e_inval);
4703+ pii->has_overlap = true;
4704+ ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
4705+
4706+ return 0;
4707+
4708+e_inval:
4709+ return -EINVAL;
4710+}
4711+
4712+static int get_parent_info(struct rbd_device *rbd_dev,
4713+ struct parent_image_info *pii)
4714+{
4715+ struct page *req_page, *reply_page;
4716+ void *p;
4717+ int ret;
4718+
4719+ req_page = alloc_page(GFP_KERNEL);
4720+ if (!req_page)
4721+ return -ENOMEM;
4722+
4723+ reply_page = alloc_page(GFP_KERNEL);
4724+ if (!reply_page) {
4725+ __free_page(req_page);
4726+ return -ENOMEM;
4727+ }
4728+
4729+ p = page_address(req_page);
4730+ ceph_encode_64(&p, rbd_dev->spec->snap_id);
4731+ ret = __get_parent_info(rbd_dev, req_page, reply_page, pii);
4732+ if (ret > 0)
4733+ ret = __get_parent_info_legacy(rbd_dev, req_page, reply_page,
4734+ pii);
4735+
4736+ __free_page(req_page);
4737+ __free_page(reply_page);
4738+ return ret;
4739+}
4740+
45874741 static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
45884742 {
45894743 struct rbd_spec *parent_spec;
4590− size_t size;
4591− void *reply_buf = NULL;
4592− __le64 snapid;
4593− void *p;
4594− void *end;
4595− u64 pool_id;
4596− char *image_id;
4597− u64 snap_id;
4598− u64 overlap;
4744+ struct parent_image_info pii = { 0 };
45994745 int ret;
46004746
46014747 parent_spec = rbd_spec_alloc();
46024748 if (!parent_spec)
46034749 return -ENOMEM;
46044750
4605− size = sizeof (__le64) + /* pool_id */
4606− sizeof (__le32) + RBD_IMAGE_ID_LEN_MAX + /* image_id */
4607− sizeof (__le64) + /* snap_id */
4608− sizeof (__le64); /* overlap */
4609− reply_buf = kmalloc(size, GFP_KERNEL);
4610− if (!reply_buf) {
4611− ret = -ENOMEM;
4751+ ret = get_parent_info(rbd_dev, &pii);
4752+ if (ret)
46124753 goto out_err;
4613− }
46144754
4615− snapid = cpu_to_le64(rbd_dev->spec->snap_id);
4616− ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid,
4617− &rbd_dev->header_oloc, "get_parent",
4618− &snapid, sizeof(snapid), reply_buf, size);
4619− dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
4620− if (ret < 0)
4621− goto out_err;
4755+ dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
4756+ __func__, pii.pool_id, pii.pool_ns, pii.image_id, pii.snap_id,
4757+ pii.has_overlap, pii.overlap);
46224758
4623− p = reply_buf;
4624− end = reply_buf + ret;
4625− ret = -ERANGE;
4626− ceph_decode_64_safe(&p, end, pool_id, out_err);
4627− if (pool_id == CEPH_NOPOOL) {
4759+ if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap) {
46284760 /*
46294761 * Either the parent never existed, or we have
46304762 * record of it but the image got flattened so it no
@@ -4633,6 +4765,10 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 2 unmodified lines
46334765 * overlap to 0. The effect of this is that all new
46344766 * requests will be treated as if the image had no
46354767 * parent.
4768+ *
4769+ * If !pii.has_overlap, the parent image spec is not
4770+ * applicable. It's there to avoid duplication in each
4771+ * snapshot record.
46364772 */
46374773 if (rbd_dev->parent_overlap) {
46384774 rbd_dev->parent_overlap = 0;
@@ -4647,51 +4783,36 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 8 unmodified lines
46474783 /* The ceph file layout needs to fit pool id in 32 bits */
46484784
46494785 ret = -EIO;
4650− if (pool_id > (u64)U32_MAX) {
4786+ if (pii.pool_id > (u64)U32_MAX) {
46514787 rbd_warn(NULL, "parent pool id too large (%llu > %u)",
4652− (unsigned long long)pool_id, U32_MAX);
4788+ (unsigned long long)pii.pool_id, U32_MAX);
46534789 goto out_err;
46544790 }
46554791
4656− image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL);
4657− if (IS_ERR(image_id)) {
4658− ret = PTR_ERR(image_id);
4659− goto out_err;
4660− }
4661− ceph_decode_64_safe(&p, end, snap_id, out_err);
4662− ceph_decode_64_safe(&p, end, overlap, out_err);
4663−
46644792 /*
46654793 * The parent won't change (except when the clone is
46664794 * flattened, already handled that). So we only need to
46674795 * record the parent spec we have not already done so.
46684796 */
46694797 if (!rbd_dev->parent_spec) {
4670− parent_spec->pool_id = pool_id;
4671− parent_spec->image_id = image_id;
4672− parent_spec->snap_id = snap_id;
4673−
4674− /* TODO: support cloning across namespaces */
4675− if (rbd_dev->spec->pool_ns) {
4676− parent_spec->pool_ns = kstrdup(rbd_dev->spec->pool_ns,
4677− GFP_KERNEL);
4678− if (!parent_spec->pool_ns) {
4679− ret = -ENOMEM;
4680− goto out_err;
4681− }
4798+ parent_spec->pool_id = pii.pool_id;
4799+ if (pii.pool_ns && *pii.pool_ns) {
4800+ parent_spec->pool_ns = pii.pool_ns;
4801+ pii.pool_ns = NULL;
46824802 }
4803+ parent_spec->image_id = pii.image_id;
4804+ pii.image_id = NULL;
4805+ parent_spec->snap_id = pii.snap_id;
46834806
46844807 rbd_dev->parent_spec = parent_spec;
46854808 parent_spec = NULL; /* rbd_dev now owns this */
4686− } else {
4687− kfree(image_id);
46884809 }
46894810
46904811 /*
46914812 * We always update the parent overlap. If it's zero we issue
46924813 * a warning, as we will proceed as if there was no parent.
46934814 */
4694− if (!overlap) {
4815+ if (!pii.overlap) {
46954816 if (parent_spec) {
46964817 /* refresh, careful to warn just once */
46974818 if (rbd_dev->parent_overlap)
@@ -4702,14 +4823,14 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 4 unmodified lines
47024823 rbd_warn(rbd_dev, "clone is standalone (overlap 0)");
47034824 }
47044825 }
4705− rbd_dev->parent_overlap = overlap;
4826+ rbd_dev->parent_overlap = pii.overlap;
47064827
47074828 out:
47084829 ret = 0;
47094830 out_err:
4710− kfree(reply_buf);
4831+ kfree(pii.pool_ns);
4832+ kfree(pii.image_id);
47114833 rbd_spec_put(parent_spec);
4712−
47134834 return ret;
47144835 }
47154836
drivers/block/xen-blkfront.c+2−2
@@ -2670,8 +2670,8 @@ static void purge_persistent_grants(struct blkfront_info *info) · 2669 unmodified lines
26702670 list_del(&gnt_list_entry->node);
26712671 gnttab_end_foreign_access(gnt_list_entry->gref, 0, 0UL);
26722672 rinfo->persistent_gnts_c--;
2673− __free_page(gnt_list_entry->page);
2674− kfree(gnt_list_entry);
2673+ gnt_list_entry->gref = GRANT_INVALID_REF;
2674+ list_add_tail(&gnt_list_entry->node, &rinfo->grants);
26752675 }
26762676
26772677 spin_unlock_irqrestore(&rinfo->ring_lock, flags);
drivers/bluetooth/hci_ldisc.c+2−0
@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) · 542 unmodified lines
543543 }
544544 clear_bit(HCI_UART_PROTO_SET, &hu->flags);
545545
546+ percpu_free_rwsem(&hu->proto_lock);
547+
546548 kfree(hu);
547549 }
548550
drivers/char/Kconfig+2−2
@@ -566,5 +566,5 @@ config RANDOM_TRUST_CPU · 565 unmodified lines
566566 that CPU manufacturer (perhaps with the insistence or mandate
567567 of a Nation State's intelligence or law enforcement agencies)
568568 has not installed a hidden back door to compromise the CPU's
569− random number generation facilities.
570−
569+ random number generation facilities. This can also be configured
570+ at boot with "random.trust_cpu=on/off".
drivers/char/ipmi/ipmi_bt_sm.c+48−44
@@ -59,8 +59,6 @@ enum bt_states { · 58 unmodified lines
5959 BT_STATE_RESET3,
6060 BT_STATE_RESTART,
6161 BT_STATE_PRINTME,
62− BT_STATE_CAPABILITIES_BEGIN,
63− BT_STATE_CAPABILITIES_END,
6462 BT_STATE_LONG_BUSY /* BT doesn't get hosed :-) */
6563 };
6664
@@ -86,7 +84,6 @@ struct si_sm_data { · 19 unmodified lines
8684 int error_retries; /* end of "common" fields */
8785 int nonzero_status; /* hung BMCs stay all 0 */
8886 enum bt_states complete; /* to divert the state machine */
89− int BT_CAP_outreqs;
9087 long BT_CAP_req2rsp;
9188 int BT_CAP_retries; /* Recommended retries */
9289 };
@@ -137,8 +134,6 @@ static char *state2txt(unsigned char state) · 44 unmodified lines
137134 case BT_STATE_RESET3: return("RESET3");
138135 case BT_STATE_RESTART: return("RESTART");
139136 case BT_STATE_LONG_BUSY: return("LONG_BUSY");
140− case BT_STATE_CAPABILITIES_BEGIN: return("CAP_BEGIN");
141− case BT_STATE_CAPABILITIES_END: return("CAP_END");
142137 }
143138 return("BAD STATE");
144139 }
@@ -185,7 +180,6 @@ static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) · 40 unmodified lines
185180 bt->complete = BT_STATE_IDLE; /* end here */
186181 bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * USEC_PER_SEC;
187182 bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT;
188− /* BT_CAP_outreqs == zero is a flag to read BT Capabilities */
189183 return 3; /* We claim 3 bytes of space; ought to check SPMI table */
190184 }
191185
@@ -451,7 +445,7 @@ static enum si_sm_result error_recovery(struct si_sm_data *bt, · 259 unmodified lines
451445
452446 static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
453447 {
454− unsigned char status, BT_CAP[8];
448+ unsigned char status;
455449 static enum bt_states last_printed = BT_STATE_PRINTME;
456450 int i;
457451
@@ -504,12 +498,6 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) · 46 unmodified lines
504498 if (status & BT_H_BUSY) /* clear a leftover H_BUSY */
505499 BT_CONTROL(BT_H_BUSY);
506500
507− bt->timeout = bt->BT_CAP_req2rsp;
508−
509− /* Read BT capabilities if it hasn't been done yet */
510− if (!bt->BT_CAP_outreqs)
511− BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN,
512− SI_SM_CALL_WITHOUT_DELAY);
513501 BT_SI_SM_RETURN(SI_SM_IDLE);
514502
515503 case BT_STATE_XACTION_START:
@@ -614,37 +602,6 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) · 98 unmodified lines
614602 BT_STATE_CHANGE(BT_STATE_XACTION_START,
615603 SI_SM_CALL_WITH_DELAY);
616604
617− /*
618− * Get BT Capabilities, using timing of upper level state machine.
619− * Set outreqs to prevent infinite loop on timeout.
620− */
621− case BT_STATE_CAPABILITIES_BEGIN:
622− bt->BT_CAP_outreqs = 1;
623− {
624− unsigned char GetBT_CAP[] = { 0x18, 0x36 };
625− bt->state = BT_STATE_IDLE;
626− bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP));
627− }
628− bt->complete = BT_STATE_CAPABILITIES_END;
629− BT_STATE_CHANGE(BT_STATE_XACTION_START,
630− SI_SM_CALL_WITH_DELAY);
631−
632− case BT_STATE_CAPABILITIES_END:
633− i = bt_get_result(bt, BT_CAP, sizeof(BT_CAP));
634− bt_init_data(bt, bt->io);
635− if ((i == 8) && !BT_CAP[2]) {
636− bt->BT_CAP_outreqs = BT_CAP[3];
637− bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC;
638− bt->BT_CAP_retries = BT_CAP[7];
639− } else
640− printk(KERN_WARNING "IPMI BT: using default values\n");
641− if (!bt->BT_CAP_outreqs)
642− bt->BT_CAP_outreqs = 1;
643− printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n",
644− bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries);
645− bt->timeout = bt->BT_CAP_req2rsp;
646− return SI_SM_CALL_WITHOUT_DELAY;
647−
648605 default: /* should never occur */
649606 return error_recovery(bt,
650607 status,
@@ -655,6 +612,11 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) · 4 unmodified lines
655612
656613 static int bt_detect(struct si_sm_data *bt)
657614 {
615+ unsigned char GetBT_CAP[] = { 0x18, 0x36 };
616+ unsigned char BT_CAP[8];
617+ enum si_sm_result smi_result;
618+ int rv;
619+
658620 /*
659621 * It's impossible for the BT status and interrupt registers to be
660622 * all 1's, (assuming a properly functioning, self-initialized BMC)
@@ -665,6 +627,48 @@ static int bt_detect(struct si_sm_data *bt) · 4 unmodified lines
665627 if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF))
666628 return 1;
667629 reset_flags(bt);
630+
631+ /*
632+ * Try getting the BT capabilities here.
633+ */
634+ rv = bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP));
635+ if (rv) {
636+ dev_warn(bt->io->dev,
637+ "Can't start capabilities transaction: %d\n", rv);
638+ goto out_no_bt_cap;
639+ }
640+
641+ smi_result = SI_SM_CALL_WITHOUT_DELAY;
642+ for (;;) {
643+ if (smi_result == SI_SM_CALL_WITH_DELAY ||
644+ smi_result == SI_SM_CALL_WITH_TICK_DELAY) {
645+ schedule_timeout_uninterruptible(1);
646+ smi_result = bt_event(bt, jiffies_to_usecs(1));
647+ } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
648+ smi_result = bt_event(bt, 0);
649+ } else
650+ break;
651+ }
652+
653+ rv = bt_get_result(bt, BT_CAP, sizeof(BT_CAP));
654+ bt_init_data(bt, bt->io);
655+ if (rv < 8) {
656+ dev_warn(bt->io->dev, "bt cap response too short: %d\n", rv);
657+ goto out_no_bt_cap;
658+ }
659+
660+ if (BT_CAP[2]) {
661+ dev_warn(bt->io->dev, "Error fetching bt cap: %x\n", BT_CAP[2]);
662+out_no_bt_cap:
663+ dev_warn(bt->io->dev, "using default values\n");
664+ } else {
665+ bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC;
666+ bt->BT_CAP_retries = BT_CAP[7];
667+ }
668+
669+ dev_info(bt->io->dev, "req2rsp=%ld secs retries=%d\n",
670+ bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries);
671+
668672 return 0;
669673 }
670674
drivers/char/ipmi/ipmi_msghandler.c+30−23
@@ -3381,39 +3381,45 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, · 3380 unmodified lines
33813381
33823382 rv = handlers->start_processing(send_info, intf);
33833383 if (rv)
3384− goto out;
3384+ goto out_err;
33853385
33863386 rv = __bmc_get_device_id(intf, NULL, &id, NULL, NULL, i);
33873387 if (rv) {
33883388 dev_err(si_dev, "Unable to get the device id: %d\n", rv);
3389− goto out;
3389+ goto out_err_started;
33903390 }
33913391
33923392 mutex_lock(&intf->bmc_reg_mutex);
33933393 rv = __scan_channels(intf, &id);
33943394 mutex_unlock(&intf->bmc_reg_mutex);
3395+ if (rv)
3396+ goto out_err_bmc_reg;
33953397
3396− out:
3397− if (rv) {
3398− ipmi_bmc_unregister(intf);
3399− list_del_rcu(&intf->link);
3400− mutex_unlock(&ipmi_interfaces_mutex);
3401− synchronize_srcu(&ipmi_interfaces_srcu);
3402− cleanup_srcu_struct(&intf->users_srcu);
3403− kref_put(&intf->refcount, intf_free);
3404− } else {
3405− /*
3406− * Keep memory order straight for RCU readers. Make
3407− * sure everything else is committed to memory before
3408− * setting intf_num to mark the interface valid.
3409− */
3410− smp_wmb();
3411− intf->intf_num = i;
3412− mutex_unlock(&ipmi_interfaces_mutex);
3398+ /*
3399+ * Keep memory order straight for RCU readers. Make
3400+ * sure everything else is committed to memory before
3401+ * setting intf_num to mark the interface valid.
3402+ */
3403+ smp_wmb();
3404+ intf->intf_num = i;
3405+ mutex_unlock(&ipmi_interfaces_mutex);
34133406
3414− /* After this point the interface is legal to use. */
3415− call_smi_watchers(i, intf->si_dev);
3416− }
3407+ /* After this point the interface is legal to use. */
3408+ call_smi_watchers(i, intf->si_dev);
3409+
3410+ return 0;
3411+
3412+ out_err_bmc_reg:
3413+ ipmi_bmc_unregister(intf);
3414+ out_err_started:
3415+ if (intf->handlers->shutdown)
3416+ intf->handlers->shutdown(intf->send_info);
3417+ out_err:
3418+ list_del_rcu(&intf->link);
3419+ mutex_unlock(&ipmi_interfaces_mutex);
3420+ synchronize_srcu(&ipmi_interfaces_srcu);
3421+ cleanup_srcu_struct(&intf->users_srcu);
3422+ kref_put(&intf->refcount, intf_free);
34173423
34183424 return rv;
34193425 }
@@ -3504,7 +3510,8 @@ void ipmi_unregister_smi(struct ipmi_smi *intf) · 84 unmodified lines
35043510 }
35053511 srcu_read_unlock(&intf->users_srcu, index);
35063512
3507− intf->handlers->shutdown(intf->send_info);
3513+ if (intf->handlers->shutdown)
3514+ intf->handlers->shutdown(intf->send_info);
35083515
35093516 cleanup_smi_msgs(intf);
35103517
drivers/char/ipmi/ipmi_si_intf.c+4−13
@@ -2083,18 +2083,9 @@ static int try_smi_init(struct smi_info *new_smi) · 2082 unmodified lines
20832083 si_to_str[new_smi->io.si_type]);
20842084
20852085 WARN_ON(new_smi->io.dev->init_name != NULL);
2086− kfree(init_name);
2087−
2088− return 0;
2089−
2090−out_err:
2091− if (new_smi->intf) {
2092− ipmi_unregister_smi(new_smi->intf);
2093− new_smi->intf = NULL;
2094− }
20952086
2087+ out_err:
20962088 kfree(init_name);
2097−
20982089 return rv;
20992090 }
21002091
@@ -2227,6 +2218,8 @@ static void shutdown_smi(void *send_info) · 126 unmodified lines
22272218
22282219 kfree(smi_info->si_sm);
22292220 smi_info->si_sm = NULL;
2221+
2222+ smi_info->intf = NULL;
22302223 }
22312224
22322225 /*
@@ -2240,10 +2233,8 @@ static void cleanup_one_si(struct smi_info *smi_info) · 7 unmodified lines
22402233
22412234 list_del(&smi_info->link);
22422235
2243− if (smi_info->intf) {
2236+ if (smi_info->intf)
22442237 ipmi_unregister_smi(smi_info->intf);
2245− smi_info->intf = NULL;
2246− }
22472238
22482239 if (smi_info->pdev) {
22492240 if (smi_info->pdev_registered)
drivers/char/ipmi/ipmi_ssif.c+11−21
@@ -181,6 +181,8 @@ struct ssif_addr_info { · 180 unmodified lines
181181 struct device *dev;
182182 struct i2c_client *client;
183183
184+ struct i2c_client *added_client;
185+
184186 struct mutex clients_mutex;
185187 struct list_head clients;
186188
@@ -1214,18 +1216,11 @@ static void shutdown_ssif(void *send_info) · 1027 unmodified lines
12141216 complete(&ssif_info->wake_thread);
12151217 kthread_stop(ssif_info->thread);
12161218 }
1217−
1218− /*
1219− * No message can be outstanding now, we have removed the
1220− * upper layer and it permitted us to do so.
1221− */
1222− kfree(ssif_info);
12231219 }
12241220
12251221 static int ssif_remove(struct i2c_client *client)
12261222 {
12271223 struct ssif_info *ssif_info = i2c_get_clientdata(client);
1228− struct ipmi_smi *intf;
12291224 struct ssif_addr_info *addr_info;
12301225
12311226 if (!ssif_info)
@@ -1235,9 +1230,7 @@ static int ssif_remove(struct i2c_client *client) · 3 unmodified lines
12351230 * After this point, we won't deliver anything asychronously
12361231 * to the message handler. We can unregister ourself.
12371232 */
1238− intf = ssif_info->intf;
1239− ssif_info->intf = NULL;
1240− ipmi_unregister_smi(intf);
1233+ ipmi_unregister_smi(ssif_info->intf);
12411234
12421235 list_for_each_entry(addr_info, &ssif_infos, link) {
12431236 if (addr_info->client == client) {
@@ -1246,6 +1239,8 @@ static int ssif_remove(struct i2c_client *client) · 2 unmodified lines
12461239 }
12471240 }
12481241
1242+ kfree(ssif_info);
1243+
12491244 return 0;
12501245 }
12511246
@@ -1648,15 +1643,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) · 396 unmodified lines
16481643
16491644 out:
16501645 if (rv) {
1651− /*
1652− * Note that if addr_info->client is assigned, we
1653− * leave it. The i2c client hangs around even if we
1654− * return a failure here, and the failure here is not
1655− * propagated back to the i2c code. This seems to be
1656− * design intent, strange as it may be. But if we
1657− * don't leave it, ssif_platform_remove will not remove
1658− * the client like it should.
1659− */
1646+ if (addr_info)
1647+ addr_info->client = NULL;
1648+
16601649 dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv);
16611650 kfree(ssif_info);
16621651 }
@@ -1676,7 +1665,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque) · 13 unmodified lines
16761665 if (adev->type != &i2c_adapter_type)
16771666 return 0;
16781667
1679− i2c_new_device(to_i2c_adapter(adev), &addr_info->binfo);
1668+ addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
1669+ &addr_info->binfo);
16801670
16811671 if (!addr_info->adapter_name)
16821672 return 1; /* Only try the first I2C adapter by default. */
@@ -1849,7 +1839,7 @@ static int ssif_platform_remove(struct platform_device *dev) · 166 unmodified lines
18491839 return 0;
18501840
18511841 mutex_lock(&ssif_infos_mutex);
1852− i2c_unregister_device(addr_info->client);
1842+ i2c_unregister_device(addr_info->added_client);
18531843
18541844 list_del(&addr_info->link);
18551845 kfree(addr_info);
drivers/char/ipmi/kcs_bmc.c+4−3
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616
1717 #include "kcs_bmc.h"
1818
19+#define DEVICE_NAME "ipmi-kcs"
20+
1921 #define KCS_MSG_BUFSIZ 1000
2022
2123 #define KCS_ZERO_DATA 0
@@ -429,8 +431,6 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel) · 407 unmodified lines
429431 if (!kcs_bmc)
430432 return NULL;
431433
432− dev_set_name(dev, "ipmi-kcs%u", channel);
433−
434434 spin_lock_init(&kcs_bmc->lock);
435435 kcs_bmc->channel = channel;
436436
@@ -444,7 +444,8 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel) · 7 unmodified lines
444444 return NULL;
445445
446446 kcs_bmc->miscdev.minor = MISC_DYNAMIC_MINOR;
447− kcs_bmc->miscdev.name = dev_name(dev);
447+ kcs_bmc->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%u",
448+ DEVICE_NAME, channel);
448449 kcs_bmc->miscdev.fops = &kcs_bmc_fops;
449450
450451 return kcs_bmc;
drivers/char/random.c+8−3
@@ -779,6 +779,13 @@ static struct crng_state **crng_node_pool __read_mostly; · 778 unmodified lines
779779
780780 static void invalidate_batched_entropy(void);
781781
782+static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU);
783+static int __init parse_trust_cpu(char *arg)
784+{
785+ return kstrtobool(arg, &trust_cpu);
786+}
787+early_param("random.trust_cpu", parse_trust_cpu);
788+
782789 static void crng_initialize(struct crng_state *crng)
783790 {
784791 int i;
@@ -799,12 +806,10 @@ static void crng_initialize(struct crng_state *crng) · 14 unmodified lines
799806 }
800807 crng->state[i] ^= rv;
801808 }
802−#ifdef CONFIG_RANDOM_TRUST_CPU
803− if (arch_init) {
809+ if (trust_cpu && arch_init) {
804810 crng_init = 2;
805811 pr_notice("random: crng done (trusting CPU's manufacturer)\n");
806812 }
807−#endif
808813 crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
809814 }
810815
drivers/clk/x86/clk-pmc-atom.c+11−7
@@ -55,6 +55,7 @@ struct clk_plt_data { · 54 unmodified lines
5555 u8 nparents;
5656 struct clk_plt *clks[PMC_CLK_NUM];
5757 struct clk_lookup *mclk_lookup;
58+ struct clk_lookup *ether_clk_lookup;
5859 };
5960
6061 /* Return an index in parent table */
@@ -186,13 +187,6 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, · 125 unmodified lines
186187 pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
187188 spin_lock_init(&pclk->lock);
188189
189− /*
190− * If the clock was already enabled by the firmware mark it as critical
191− * to avoid it being gated by the clock framework if no driver owns it.
192− */
193− if (plt_clk_is_enabled(&pclk->hw))
194− init.flags |= CLK_IS_CRITICAL;
195−
196190 ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
197191 if (ret) {
198192 pclk = ERR_PTR(ret);
@@ -351,11 +345,20 @@ static int plt_clk_probe(struct platform_device *pdev) · 152 unmodified lines
351345 goto err_unreg_clk_plt;
352346 }
353347
348+ data->ether_clk_lookup = clkdev_hw_create(&data->clks[4]->hw,
349+ "ether_clk", NULL);
350+ if (!data->ether_clk_lookup) {
351+ err = -ENOMEM;
352+ goto err_drop_mclk;
353+ }
354+
354355 plt_clk_free_parent_names_loop(parent_names, data->nparents);
355356
356357 platform_set_drvdata(pdev, data);
357358 return 0;
358359
360+err_drop_mclk:
361+ clkdev_drop(data->mclk_lookup);
359362 err_unreg_clk_plt:
360363 plt_clk_unregister_loop(data, i);
361364 plt_clk_unregister_parents(data);
@@ -369,6 +372,7 @@ static int plt_clk_remove(struct platform_device *pdev) · 7 unmodified lines
369372
370373 data = platform_get_drvdata(pdev);
371374
375+ clkdev_drop(data->ether_clk_lookup);
372376 clkdev_drop(data->mclk_lookup);
373377 plt_clk_unregister_loop(data, PMC_CLK_NUM);
374378 plt_clk_unregister_parents(data);
drivers/clocksource/timer-atmel-pit.c+14−6
@@ -180,26 +180,29 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) · 179 unmodified lines
180180 data->base = of_iomap(node, 0);
181181 if (!data->base) {
182182 pr_err("Could not map PIT address\n");
183− return -ENXIO;
183+ ret = -ENXIO;
184+ goto exit;
184185 }
185186
186187 data->mck = of_clk_get(node, 0);
187188 if (IS_ERR(data->mck)) {
188189 pr_err("Unable to get mck clk\n");
189− return PTR_ERR(data->mck);
190+ ret = PTR_ERR(data->mck);
191+ goto exit;
190192 }
191193
192194 ret = clk_prepare_enable(data->mck);
193195 if (ret) {
194196 pr_err("Unable to enable mck\n");
195− return ret;
197+ goto exit;
196198 }
197199
198200 /* Get the interrupts property */
199201 data->irq = irq_of_parse_and_map(node, 0);
200202 if (!data->irq) {
201203 pr_err("Unable to get IRQ from DT\n");
202− return -EINVAL;
204+ ret = -EINVAL;
205+ goto exit;
203206 }
204207
205208 /*
@@ -227,7 +230,7 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) · 21 unmodified lines
227230 ret = clocksource_register_hz(&data->clksrc, pit_rate);
228231 if (ret) {
229232 pr_err("Failed to register clocksource\n");
230− return ret;
233+ goto exit;
231234 }
232235
233236 /* Set up irq handler */
@@ -236,7 +239,8 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) · 2 unmodified lines
236239 "at91_tick", data);
237240 if (ret) {
238241 pr_err("Unable to setup IRQ\n");
239− return ret;
242+ clocksource_unregister(&data->clksrc);
243+ goto exit;
240244 }
241245
242246 /* Set up and register clockevents */
@@ -254,6 +258,10 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) · 11 unmodified lines
254258 clockevents_register_device(&data->clkevt);
255259
256260 return 0;
261+
262+exit:
263+ kfree(data);
264+ return ret;
257265 }
258266 TIMER_OF_DECLARE(at91sam926x_pit, "atmel,at91sam9260-pit",
259267 at91sam926x_pit_dt_init);
drivers/clocksource/timer-fttmr010.c+11−7
@@ -130,13 +130,17 @@ static int fttmr010_timer_set_next_event(unsigned long cycles, · 129 unmodified lines
130130 cr &= ~fttmr010->t1_enable_val;
131131 writel(cr, fttmr010->base + TIMER_CR);
132132
133− /* Setup the match register forward/backward in time */
134− cr = readl(fttmr010->base + TIMER1_COUNT);
135− if (fttmr010->count_down)
136− cr -= cycles;
137− else
138− cr += cycles;
139− writel(cr, fttmr010->base + TIMER1_MATCH1);
133+ if (fttmr010->count_down) {
134+ /*
135+ * ASPEED Timer Controller will load TIMER1_LOAD register
136+ * into TIMER1_COUNT register when the timer is re-enabled.
137+ */
138+ writel(cycles, fttmr010->base + TIMER1_LOAD);
139+ } else {
140+ /* Setup the match register forward in time */
141+ cr = readl(fttmr010->base + TIMER1_COUNT);
142+ writel(cr + cycles, fttmr010->base + TIMER1_MATCH1);
143+ }
140144
141145 /* Start */
142146 cr = readl(fttmr010->base + TIMER_CR);
drivers/clocksource/timer-ti-32k.c+3−0
@@ -97,6 +97,9 @@ static int __init ti_32k_timer_init(struct device_node *np) · 96 unmodified lines
9797 return -ENXIO;
9898 }
9999
100+ if (!of_machine_is_compatible("ti,am43"))
101+ ti_32k_timer.cs.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
102+
100103 ti_32k_timer.counter = ti_32k_timer.base;
101104
102105 /*
drivers/cpufreq/qcom-cpufreq-kryo.c+2−2
@@ -44,7 +44,7 @@ enum _msm8996_version { · 43 unmodified lines
4444
4545 struct platform_device *cpufreq_dt_pdev, *kryo_cpufreq_pdev;
4646
47−static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void)
47+static enum _msm8996_version qcom_cpufreq_kryo_get_msm_id(void)
4848 {
4949 size_t len;
5050 u32 *msm_id;
@@ -222,7 +222,7 @@ static int __init qcom_cpufreq_kryo_init(void) · 171 unmodified lines
222222 }
223223 module_init(qcom_cpufreq_kryo_init);
224224
225−static void __init qcom_cpufreq_kryo_exit(void)
225+static void __exit qcom_cpufreq_kryo_exit(void)
226226 {
227227 platform_device_unregister(kryo_cpufreq_pdev);
228228 platform_driver_unregister(&qcom_cpufreq_kryo_driver);
drivers/crypto/ccp/psp-dev.c+41−5
@@ -38,6 +38,17 @@ static DEFINE_MUTEX(sev_cmd_mutex); · 37 unmodified lines
3838 static struct sev_misc_dev *misc_dev;
3939 static struct psp_device *psp_master;
4040
41+static int psp_cmd_timeout = 100;
42+module_param(psp_cmd_timeout, int, 0644);
43+MODULE_PARM_DESC(psp_cmd_timeout, " default timeout value, in seconds, for PSP commands");
44+
45+static int psp_probe_timeout = 5;
46+module_param(psp_probe_timeout, int, 0644);
47+MODULE_PARM_DESC(psp_probe_timeout, " default timeout value, in seconds, during PSP device probe");
48+
49+static bool psp_dead;
50+static int psp_timeout;
51+
4152 static struct psp_device *psp_alloc_struct(struct sp_device *sp)
4253 {
4354 struct device *dev = sp->dev;
@@ -82,10 +93,19 @@ done: · 38 unmodified lines
8293 return IRQ_HANDLED;
8394 }
8495
85−static void sev_wait_cmd_ioc(struct psp_device *psp, unsigned int *reg)
96+static int sev_wait_cmd_ioc(struct psp_device *psp,
97+ unsigned int *reg, unsigned int timeout)
8698 {
87− wait_event(psp->sev_int_queue, psp->sev_int_rcvd);
99+ int ret;
100+
101+ ret = wait_event_timeout(psp->sev_int_queue,
102+ psp->sev_int_rcvd, timeout * HZ);
103+ if (!ret)
104+ return -ETIMEDOUT;
105+
88106 *reg = ioread32(psp->io_regs + psp->vdata->cmdresp_reg);
107+
108+ return 0;
89109 }
90110
91111 static int sev_cmd_buffer_len(int cmd)
@@ -133,12 +153,15 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) · 41 unmodified lines
133153 if (!psp)
134154 return -ENODEV;
135155
156+ if (psp_dead)
157+ return -EBUSY;
158+
136159 /* Get the physical address of the command buffer */
137160 phys_lsb = data ? lower_32_bits(__psp_pa(data)) : 0;
138161 phys_msb = data ? upper_32_bits(__psp_pa(data)) : 0;
139162
140− dev_dbg(psp->dev, "sev command id %#x buffer 0x%08x%08x\n",
141− cmd, phys_msb, phys_lsb);
163+ dev_dbg(psp->dev, "sev command id %#x buffer 0x%08x%08x timeout %us\n",
164+ cmd, phys_msb, phys_lsb, psp_timeout);
142165
143166 print_hex_dump_debug("(in): ", DUMP_PREFIX_OFFSET, 16, 2, data,
144167 sev_cmd_buffer_len(cmd), false);
@@ -154,7 +177,18 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) · 9 unmodified lines
154177 iowrite32(reg, psp->io_regs + psp->vdata->cmdresp_reg);
155178
156179 /* wait for command completion */
157− sev_wait_cmd_ioc(psp, &reg);
180+ ret = sev_wait_cmd_ioc(psp, &reg, psp_timeout);
181+ if (ret) {
182+ if (psp_ret)
183+ *psp_ret = 0;
184+
185+ dev_err(psp->dev, "sev command %#x timed out, disabling PSP \n", cmd);
186+ psp_dead = true;
187+
188+ return ret;
189+ }
190+
191+ psp_timeout = psp_cmd_timeout;
158192
159193 if (psp_ret)
160194 *psp_ret = reg & PSP_CMDRESP_ERR_MASK;
@@ -888,6 +922,8 @@ void psp_pci_init(void) · 727 unmodified lines
888922
889923 psp_master = sp->psp_data;
890924
925+ psp_timeout = psp_probe_timeout;
926+
891927 if (sev_get_api_version())
892928 goto err;
893929
drivers/dax/device.c+6−0
@@ -535,6 +535,11 @@ static unsigned long dax_get_unmapped_area(struct file *filp, · 534 unmodified lines
535535 return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
536536 }
537537
538+static const struct address_space_operations dev_dax_aops = {
539+ .set_page_dirty = noop_set_page_dirty,
540+ .invalidatepage = noop_invalidatepage,
541+};
542+
538543 static int dax_open(struct inode *inode, struct file *filp)
539544 {
540545 struct dax_device *dax_dev = inode_dax(inode);
@@ -544,6 +549,7 @@ static int dax_open(struct inode *inode, struct file *filp) · 3 unmodified lines
544549 dev_dbg(&dev_dax->dev, "trace\n");
545550 inode->i_mapping = __dax_inode->i_mapping;
546551 inode->i_mapping->host = __dax_inode;
552+ inode->i_mapping->a_ops = &dev_dax_aops;
547553 filp->f_mapping = inode->i_mapping;
548554 filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping);
549555 filp->private_data = dev_dax;
drivers/dma/mic_x100_dma.c+1−3
@@ -639,7 +639,7 @@ static struct mic_dma_device *mic_dma_dev_reg(struct mbus_device *mbdev, · 638 unmodified lines
639639 int ret;
640640 struct device *dev = &mbdev->dev;
641641
642− mic_dma_dev = kzalloc(sizeof(*mic_dma_dev), GFP_KERNEL);
642+ mic_dma_dev = devm_kzalloc(dev, sizeof(*mic_dma_dev), GFP_KERNEL);
643643 if (!mic_dma_dev) {
644644 ret = -ENOMEM;
645645 goto alloc_error;
@@ -664,7 +664,6 @@ static struct mic_dma_device *mic_dma_dev_reg(struct mbus_device *mbdev, · 18 unmodified lines
664664 reg_error:
665665 mic_dma_uninit(mic_dma_dev);
666666 init_error:
667− kfree(mic_dma_dev);
668667 mic_dma_dev = NULL;
669668 alloc_error:
670669 dev_err(dev, "Error at %s %d ret=%d\n", __func__, __LINE__, ret);
@@ -674,7 +673,6 @@ alloc_error: · 3 unmodified lines
674673 static void mic_dma_dev_unreg(struct mic_dma_device *mic_dma_dev)
675674 {
676675 mic_dma_uninit(mic_dma_dev);
677− kfree(mic_dma_dev);
678676 }
679677
680678 /* DEBUGFS CODE */
drivers/firmware/arm_scmi/perf.c+7−1
@@ -166,7 +166,13 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain, · 165 unmodified lines
166166 le32_to_cpu(attr->sustained_freq_khz);
167167 dom_info->sustained_perf_level =
168168 le32_to_cpu(attr->sustained_perf_level);
169− dom_info->mult_factor = (dom_info->sustained_freq_khz * 1000) /
169+ if (!dom_info->sustained_freq_khz ||
170+ !dom_info->sustained_perf_level)
171+ /* CPUFreq converts to kHz, hence default 1000 */
172+ dom_info->mult_factor = 1000;
173+ else
174+ dom_info->mult_factor =
175+ (dom_info->sustained_freq_khz * 1000) /
170176 dom_info->sustained_perf_level;
171177 memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
172178 }
drivers/firmware/efi/Kconfig+6−3
@@ -90,14 +90,17 @@ config EFI_ARMSTUB · 89 unmodified lines
9090 config EFI_ARMSTUB_DTB_LOADER
9191 bool "Enable the DTB loader"
9292 depends on EFI_ARMSTUB
93+ default y
9394 help
9495 Select this config option to add support for the dtb= command
9596 line parameter, allowing a device tree blob to be loaded into
9697 memory from the EFI System Partition by the stub.
9798
98− The device tree is typically provided by the platform or by
99− the bootloader, so this option is mostly for development
100− purposes only.
99+ If the device tree is provided by the platform or by
100+ the bootloader this option may not be needed.
101+ But, for various development reasons and to maintain existing
102+ functionality for bootloaders that do not have such support
103+ this option is necessary.
101104
102105 config EFI_BOOTLOADER_CONTROL
103106 tristate "EFI Bootloader Control"
drivers/fpga/dfl-fme-pr.c+1−1
@@ -420,7 +420,7 @@ static int pr_mgmt_init(struct platform_device *pdev, · 419 unmodified lines
420420 /* Create region for each port */
421421 fme_region = dfl_fme_create_region(pdata, mgr,
422422 fme_br->br, i);
423− if (!fme_region) {
423+ if (IS_ERR(fme_region)) {
424424 ret = PTR_ERR(fme_region);
425425 goto destroy_region;
426426 }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+5−1
@@ -272,7 +272,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) · 271 unmodified lines
272272
273273 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
274274 void **mem_obj, uint64_t *gpu_addr,
275− void **cpu_ptr)
275+ void **cpu_ptr, bool mqd_gfx9)
276276 {
277277 struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
278278 struct amdgpu_bo *bo = NULL;
@@ -287,6 +287,10 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, · 8 unmodified lines
287287 bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC;
288288 bp.type = ttm_bo_type_kernel;
289289 bp.resv = NULL;
290+
291+ if (mqd_gfx9)
292+ bp.flags |= AMDGPU_GEM_CREATE_MQD_GFX9;
293+
290294 r = amdgpu_bo_create(adev, &bp, &bo);
291295 if (r) {
292296 dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+1−1
@@ -136,7 +136,7 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd); · 135 unmodified lines
136136 /* Shared API */
137137 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
138138 void **mem_obj, uint64_t *gpu_addr,
139− void **cpu_ptr);
139+ void **cpu_ptr, bool mqd_gfx9);
140140 void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj);
141141 void get_local_mem_info(struct kgd_dev *kgd,
142142 struct kfd_local_mem_info *mem_info);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c+1−1
@@ -685,7 +685,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, · 684 unmodified lines
685685
686686 while (true) {
687687 temp = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);
688− if (temp & SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT)
688+ if (temp & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)
689689 break;
690690 if (time_after(jiffies, end_jiffies))
691691 return -ETIME;
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c+8−6
@@ -367,12 +367,14 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, · 366 unmodified lines
367367 break;
368368 case CHIP_POLARIS10:
369369 if (type == CGS_UCODE_ID_SMU) {
370− if ((adev->pdev->device == 0x67df) &&
371− ((adev->pdev->revision == 0xe0) ||
372− (adev->pdev->revision == 0xe3) ||
373− (adev->pdev->revision == 0xe4) ||
374− (adev->pdev->revision == 0xe5) ||
375− (adev->pdev->revision == 0xe7) ||
370+ if (((adev->pdev->device == 0x67df) &&
371+ ((adev->pdev->revision == 0xe0) ||
372+ (adev->pdev->revision == 0xe3) ||
373+ (adev->pdev->revision == 0xe4) ||
374+ (adev->pdev->revision == 0xe5) ||
375+ (adev->pdev->revision == 0xe7) ||
376+ (adev->pdev->revision == 0xef))) ||
377+ ((adev->pdev->device == 0x6fdf) &&
376378 (adev->pdev->revision == 0xef))) {
377379 info->is_kicker = true;
378380 strcpy(fw_name, "amdgpu/polaris10_k_smc.bin");
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+16−9
@@ -39,6 +39,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, · 38 unmodified lines
3939 {
4040 struct drm_gem_object *gobj;
4141 unsigned long size;
42+ int r;
4243
4344 gobj = drm_gem_object_lookup(p->filp, data->handle);
4445 if (gobj == NULL)
@@ -50,20 +51,26 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, · 5 unmodified lines
5051 p->uf_entry.tv.shared = true;
5152 p->uf_entry.user_pages = NULL;
5253
53− size = amdgpu_bo_size(p->uf_entry.robj);
54− if (size != PAGE_SIZE || (data->offset + 8) > size)
55− return -EINVAL;
56−
57− *offset = data->offset;
58−
5954 drm_gem_object_put_unlocked(gobj);
6055
56+ size = amdgpu_bo_size(p->uf_entry.robj);
57+ if (size != PAGE_SIZE || (data->offset + 8) > size) {
58+ r = -EINVAL;
59+ goto error_unref;
60+ }
61+
6162 if (amdgpu_ttm_tt_get_usermm(p->uf_entry.robj->tbo.ttm)) {
62− amdgpu_bo_unref(&p->uf_entry.robj);
63− return -EINVAL;
63+ r = -EINVAL;
64+ goto error_unref;
6465 }
6566
67+ *offset = data->offset;
68+
6669 return 0;
70+
71+error_unref:
72+ amdgpu_bo_unref(&p->uf_entry.robj);
73+ return r;
6774 }
6875
6976 static int amdgpu_cs_bo_handles_chunk(struct amdgpu_cs_parser *p,
@@ -1262,10 +1269,10 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, · 1192 unmodified lines
12621269 error_abort:
12631270 dma_fence_put(&job->base.s_fence->finished);
12641271 job->base.s_fence = NULL;
1272+ amdgpu_mn_unlock(p->mn);
12651273
12661274 error_unlock:
12671275 amdgpu_job_free(job);
1268− amdgpu_mn_unlock(p->mn);
12691276 return r;
12701277 }
12711278
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+1−1
@@ -2063,6 +2063,7 @@ static int amdgpu_device_ip_reinit_early_sriov(struct amdgpu_device *adev) · 2062 unmodified lines
20632063 static enum amd_ip_block_type ip_order[] = {
20642064 AMD_IP_BLOCK_TYPE_GMC,
20652065 AMD_IP_BLOCK_TYPE_COMMON,
2066+ AMD_IP_BLOCK_TYPE_PSP,
20662067 AMD_IP_BLOCK_TYPE_IH,
20672068 };
20682069
@@ -2093,7 +2094,6 @@ static int amdgpu_device_ip_reinit_late_sriov(struct amdgpu_device *adev) · 24 unmodified lines
20932094
20942095 static enum amd_ip_block_type ip_order[] = {
20952096 AMD_IP_BLOCK_TYPE_SMC,
2096− AMD_IP_BLOCK_TYPE_PSP,
20972097 AMD_IP_BLOCK_TYPE_DCE,
20982098 AMD_IP_BLOCK_TYPE_GFX,
20992099 AMD_IP_BLOCK_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -740,6 +740,7 @@ static const struct pci_device_id pciidlist[] = { · 739 unmodified lines
740740 {0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
741741 {0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
742742 {0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
743+ {0x1002, 0x6FDF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
743744 /* Polaris12 */
744745 {0x1002, 0x6980, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
745746 {0x1002, 0x6981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c+2−1
@@ -258,6 +258,8 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev) · 257 unmodified lines
258258 {
259259 int i;
260260
261+ cancel_delayed_work_sync(&adev->vce.idle_work);
262+
261263 if (adev->vce.vcpu_bo == NULL)
262264 return 0;
263265
@@ -268,7 +270,6 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev) · 4 unmodified lines
268270 if (i == AMDGPU_MAX_VCE_HANDLES)
269271 return 0;
270272
271− cancel_delayed_work_sync(&adev->vce.idle_work);
272273 /* TODO: suspending running encoding sessions isn't supported */
273274 return -EINVAL;
274275 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+2−2
@@ -153,11 +153,11 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev) · 152 unmodified lines
153153 unsigned size;
154154 void *ptr;
155155
156+ cancel_delayed_work_sync(&adev->vcn.idle_work);
157+
156158 if (adev->vcn.vcpu_bo == NULL)
157159 return 0;
158160
159− cancel_delayed_work_sync(&adev->vcn.idle_work);
160−
161161 size = amdgpu_bo_size(adev->vcn.vcpu_bo);
162162 ptr = adev->vcn.cpu_addr;
163163
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c+5−2
@@ -70,6 +70,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { · 69 unmodified lines
7070 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_IB_CNTL, 0x800f0100, 0x00000100),
7171 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
7272 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),
73+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000),
7374 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
7475 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100),
7576 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100),
@@ -81,7 +82,8 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { · 5 unmodified lines
8182 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_RLC0_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
8283 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_RLC1_IB_CNTL, 0x800f0100, 0x00000100),
8384 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
84− SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_UTCL1_PAGE, 0x000003ff, 0x000003c0)
85+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_UTCL1_PAGE, 0x000003ff, 0x000003c0),
86+ SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_UTCL1_WATERMK, 0xfc000000, 0x00000000)
8587 };
8688
8789 static const struct soc15_reg_golden golden_settings_sdma_vg10[] = {
@@ -109,7 +111,8 @@ static const struct soc15_reg_golden golden_settings_sdma_4_1[] = · 21 unmodified lines
109111 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
110112 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_IB_CNTL, 0x800f0111, 0x00000100),
111113 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
112− SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0)
114+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),
115+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000)
113116 };
114117
115118 static const struct soc15_reg_golden golden_settings_sdma_4_2[] =
drivers/gpu/drm/amd/amdkfd/kfd_device.c+2−1
@@ -457,7 +457,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, · 456 unmodified lines
457457
458458 if (kfd->kfd2kgd->init_gtt_mem_allocation(
459459 kfd->kgd, size, &kfd->gtt_mem,
460− &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)){
460+ &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr,
461+ false)) {
461462 dev_err(kfd_device, "Could not allocate %d bytes\n", size);
462463 goto out;
463464 }
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c+12−1
@@ -62,9 +62,20 @@ int kfd_iommu_device_init(struct kfd_dev *kfd) · 61 unmodified lines
6262 struct amd_iommu_device_info iommu_info;
6363 unsigned int pasid_limit;
6464 int err;
65+ struct kfd_topology_device *top_dev;
6566
66− if (!kfd->device_info->needs_iommu_device)
67+ top_dev = kfd_topology_device_by_id(kfd->id);
68+
69+ /*
70+ * Overwrite ATS capability according to needs_iommu_device to fix
71+ * potential missing corresponding bit in CRAT of BIOS.
72+ */
73+ if (!kfd->device_info->needs_iommu_device) {
74+ top_dev->node_props.capability &= ~HSA_CAP_ATS_PRESENT;
6775 return 0;
76+ }
77+
78+ top_dev->node_props.capability |= HSA_CAP_ATS_PRESENT;
6879
6980 iommu_info.flags = 0;
7081 err = amd_iommu_device_info(kfd->pdev, &iommu_info);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c+1−1
@@ -88,7 +88,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd, · 87 unmodified lines
8888 ALIGN(sizeof(struct v9_mqd), PAGE_SIZE),
8989 &((*mqd_mem_obj)->gtt_mem),
9090 &((*mqd_mem_obj)->gpu_addr),
91− (void *)&((*mqd_mem_obj)->cpu_ptr));
91+ (void *)&((*mqd_mem_obj)->cpu_ptr), true);
9292 } else
9393 retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct v9_mqd),
9494 mqd_mem_obj);
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+1−0
@@ -806,6 +806,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu); · 805 unmodified lines
806806 int kfd_topology_remove_device(struct kfd_dev *gpu);
807807 struct kfd_topology_device *kfd_topology_device_by_proximity_domain(
808808 uint32_t proximity_domain);
809+struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id);
809810 struct kfd_dev *kfd_device_by_id(uint32_t gpu_id);
810811 struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev);
811812 int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.c+16−5
@@ -63,22 +63,33 @@ struct kfd_topology_device *kfd_topology_device_by_proximity_domain( · 62 unmodified lines
6363 return device;
6464 }
6565
66−struct kfd_dev *kfd_device_by_id(uint32_t gpu_id)
66+struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id)
6767 {
68− struct kfd_topology_device *top_dev;
69− struct kfd_dev *device = NULL;
68+ struct kfd_topology_device *top_dev = NULL;
69+ struct kfd_topology_device *ret = NULL;
7070
7171 down_read(&topology_lock);
7272
7373 list_for_each_entry(top_dev, &topology_device_list, list)
7474 if (top_dev->gpu_id == gpu_id) {
75− device = top_dev->gpu;
75+ ret = top_dev;
7676 break;
7777 }
7878
7979 up_read(&topology_lock);
8080
81− return device;
81+ return ret;
82+}
83+
84+struct kfd_dev *kfd_device_by_id(uint32_t gpu_id)
85+{
86+ struct kfd_topology_device *top_dev;
87+
88+ top_dev = kfd_topology_device_by_id(gpu_id);
89+ if (!top_dev)
90+ return NULL;
91+
92+ return top_dev->gpu;
8293 }
8394
8495 struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+134−5
@@ -641,6 +641,87 @@ amdgpu_dm_find_first_crtc_matching_connector(struct drm_atomic_state *state, · 640 unmodified lines
641641 return NULL;
642642 }
643643
644+static void emulated_link_detect(struct dc_link *link)
645+{
646+ struct dc_sink_init_data sink_init_data = { 0 };
647+ struct display_sink_capability sink_caps = { 0 };
648+ enum dc_edid_status edid_status;
649+ struct dc_context *dc_ctx = link->ctx;
650+ struct dc_sink *sink = NULL;
651+ struct dc_sink *prev_sink = NULL;
652+
653+ link->type = dc_connection_none;
654+ prev_sink = link->local_sink;
655+
656+ if (prev_sink != NULL)
657+ dc_sink_retain(prev_sink);
658+
659+ switch (link->connector_signal) {
660+ case SIGNAL_TYPE_HDMI_TYPE_A: {
661+ sink_caps.transaction_type = DDC_TRANSACTION_TYPE_I2C;
662+ sink_caps.signal = SIGNAL_TYPE_HDMI_TYPE_A;
663+ break;
664+ }
665+
666+ case SIGNAL_TYPE_DVI_SINGLE_LINK: {
667+ sink_caps.transaction_type = DDC_TRANSACTION_TYPE_I2C;
668+ sink_caps.signal = SIGNAL_TYPE_DVI_SINGLE_LINK;
669+ break;
670+ }
671+
672+ case SIGNAL_TYPE_DVI_DUAL_LINK: {
673+ sink_caps.transaction_type = DDC_TRANSACTION_TYPE_I2C;
674+ sink_caps.signal = SIGNAL_TYPE_DVI_DUAL_LINK;
675+ break;
676+ }
677+
678+ case SIGNAL_TYPE_LVDS: {
679+ sink_caps.transaction_type = DDC_TRANSACTION_TYPE_I2C;
680+ sink_caps.signal = SIGNAL_TYPE_LVDS;
681+ break;
682+ }
683+
684+ case SIGNAL_TYPE_EDP: {
685+ sink_caps.transaction_type =
686+ DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
687+ sink_caps.signal = SIGNAL_TYPE_EDP;
688+ break;
689+ }
690+
691+ case SIGNAL_TYPE_DISPLAY_PORT: {
692+ sink_caps.transaction_type =
693+ DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
694+ sink_caps.signal = SIGNAL_TYPE_VIRTUAL;
695+ break;
696+ }
697+
698+ default:
699+ DC_ERROR("Invalid connector type! signal:%d\n",
700+ link->connector_signal);
701+ return;
702+ }
703+
704+ sink_init_data.link = link;
705+ sink_init_data.sink_signal = sink_caps.signal;
706+
707+ sink = dc_sink_create(&sink_init_data);
708+ if (!sink) {
709+ DC_ERROR("Failed to create sink!\n");
710+ return;
711+ }
712+
713+ link->local_sink = sink;
714+
715+ edid_status = dm_helpers_read_local_edid(
716+ link->ctx,
717+ link,
718+ sink);
719+
720+ if (edid_status != EDID_OK)
721+ DC_ERROR("Failed to read EDID");
722+
723+}
724+
644725 static int dm_resume(void *handle)
645726 {
646727 struct amdgpu_device *adev = handle;
@@ -654,6 +735,7 @@ static int dm_resume(void *handle) · 7 unmodified lines
654735 struct drm_plane *plane;
655736 struct drm_plane_state *new_plane_state;
656737 struct dm_plane_state *dm_new_plane_state;
738+ enum dc_connection_type new_connection_type = dc_connection_none;
657739 int ret;
658740 int i;
659741
@@ -684,7 +766,13 @@ static int dm_resume(void *handle) · 24 unmodified lines
684766 continue;
685767
686768 mutex_lock(&aconnector->hpd_lock);
687− dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
769+ if (!dc_link_detect_sink(aconnector->dc_link, &new_connection_type))
770+ DRM_ERROR("KMS: Failed to detect connector\n");
771+
772+ if (aconnector->base.force && new_connection_type == dc_connection_none)
773+ emulated_link_detect(aconnector->dc_link);
774+ else
775+ dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
688776
689777 if (aconnector->fake_enable && aconnector->dc_link->local_sink)
690778 aconnector->fake_enable = false;
@@ -922,6 +1010,7 @@ static void handle_hpd_irq(void *param) · 231 unmodified lines
9221010 struct amdgpu_dm_connector *aconnector = (struct amdgpu_dm_connector *)param;
9231011 struct drm_connector *connector = &aconnector->base;
9241012 struct drm_device *dev = connector->dev;
1013+ enum dc_connection_type new_connection_type = dc_connection_none;
9251014
9261015 /* In case of failure or MST no need to update connector status or notify the OS
9271016 * since (for MST case) MST does this in it's own context.
@@ -931,7 +1020,21 @@ static void handle_hpd_irq(void *param) · 3 unmodified lines
9311020 if (aconnector->fake_enable)
9321021 aconnector->fake_enable = false;
9331022
934− if (dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD)) {
1023+ if (!dc_link_detect_sink(aconnector->dc_link, &new_connection_type))
1024+ DRM_ERROR("KMS: Failed to detect connector\n");
1025+
1026+ if (aconnector->base.force && new_connection_type == dc_connection_none) {
1027+ emulated_link_detect(aconnector->dc_link);
1028+
1029+
1030+ drm_modeset_lock_all(dev);
1031+ dm_restore_drm_connector_state(dev, connector);
1032+ drm_modeset_unlock_all(dev);
1033+
1034+ if (aconnector->base.force == DRM_FORCE_UNSPECIFIED)
1035+ drm_kms_helper_hotplug_event(dev);
1036+
1037+ } else if (dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD)) {
9351038 amdgpu_dm_update_connector_after_detect(aconnector);
9361039
9371040
@@ -1031,6 +1134,7 @@ static void handle_hpd_rx_irq(void *param) · 93 unmodified lines
10311134 struct drm_device *dev = connector->dev;
10321135 struct dc_link *dc_link = aconnector->dc_link;
10331136 bool is_mst_root_connector = aconnector->mst_mgr.mst_state;
1137+ enum dc_connection_type new_connection_type = dc_connection_none;
10341138
10351139 /* TODO:Temporary add mutex to protect hpd interrupt not have a gpio
10361140 * conflict, after implement i2c helper, this mutex should be
@@ -1042,7 +1146,24 @@ static void handle_hpd_rx_irq(void *param) · 5 unmodified lines
10421146 if (dc_link_handle_hpd_rx_irq(dc_link, NULL, NULL) &&
10431147 !is_mst_root_connector) {
10441148 /* Downstream Port status changed. */
1045− if (dc_link_detect(dc_link, DETECT_REASON_HPDRX)) {
1149+ if (!dc_link_detect_sink(dc_link, &new_connection_type))
1150+ DRM_ERROR("KMS: Failed to detect connector\n");
1151+
1152+ if (aconnector->base.force && new_connection_type == dc_connection_none) {
1153+ emulated_link_detect(dc_link);
1154+
1155+ if (aconnector->fake_enable)
1156+ aconnector->fake_enable = false;
1157+
1158+ amdgpu_dm_update_connector_after_detect(aconnector);
1159+
1160+
1161+ drm_modeset_lock_all(dev);
1162+ dm_restore_drm_connector_state(dev, connector);
1163+ drm_modeset_unlock_all(dev);
1164+
1165+ drm_kms_helper_hotplug_event(dev);
1166+ } else if (dc_link_detect(dc_link, DETECT_REASON_HPDRX)) {
10461167
10471168 if (aconnector->fake_enable)
10481169 aconnector->fake_enable = false;
@@ -1433,6 +1554,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 384 unmodified lines
14331554 struct amdgpu_mode_info *mode_info = &adev->mode_info;
14341555 uint32_t link_cnt;
14351556 int32_t total_overlay_planes, total_primary_planes;
1557+ enum dc_connection_type new_connection_type = dc_connection_none;
14361558
14371559 link_cnt = dm->dc->caps.max_links;
14381560 if (amdgpu_dm_mode_config_init(dm->adev)) {
@@ -1499,7 +1621,14 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 60 unmodified lines
14991621
15001622 link = dc_get_link_at_index(dm->dc, i);
15011623
1502− if (dc_link_detect(link, DETECT_REASON_BOOT)) {
1624+ if (!dc_link_detect_sink(link, &new_connection_type))
1625+ DRM_ERROR("KMS: Failed to detect connector\n");
1626+
1627+ if (aconnector->base.force && new_connection_type == dc_connection_none) {
1628+ emulated_link_detect(link);
1629+ amdgpu_dm_update_connector_after_detect(aconnector);
1630+
1631+ } else if (dc_link_detect(link, DETECT_REASON_BOOT)) {
15031632 amdgpu_dm_update_connector_after_detect(aconnector);
15041633 register_backlight_device(dm, link);
15051634 }
@@ -2494,7 +2623,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 988 unmodified lines
24942623 if (dm_state && dm_state->freesync_capable)
24952624 stream->ignore_msa_timing_param = true;
24962625 finish:
2497− if (sink && sink->sink_signal == SIGNAL_TYPE_VIRTUAL)
2626+ if (sink && sink->sink_signal == SIGNAL_TYPE_VIRTUAL && aconnector->base.force != DRM_FORCE_ON)
24982627 dc_sink_release(sink);
24992628
25002629 return stream;
drivers/gpu/drm/amd/display/dc/core/dc_link.c+2−2
@@ -195,7 +195,7 @@ static bool program_hpd_filter( · 194 unmodified lines
195195 return result;
196196 }
197197
198−static bool detect_sink(struct dc_link *link, enum dc_connection_type *type)
198+bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type)
199199 {
200200 uint32_t is_hpd_high = 0;
201201 struct gpio *hpd_pin;
@@ -604,7 +604,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) · 402 unmodified lines
604604 if (link->connector_signal == SIGNAL_TYPE_VIRTUAL)
605605 return false;
606606
607− if (false == detect_sink(link, &new_connection_type)) {
607+ if (false == dc_link_detect_sink(link, &new_connection_type)) {
608608 BREAK_TO_DEBUGGER();
609609 return false;
610610 }
drivers/gpu/drm/amd/display/dc/dc_link.h+1−0
@@ -215,6 +215,7 @@ void dc_link_enable_hpd_filter(struct dc_link *link, bool enable); · 214 unmodified lines
215215
216216 bool dc_link_is_dp_sink_present(struct dc_link *link);
217217
218+bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type);
218219 /*
219220 * DPCD access interfaces
220221 */
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+1−1
@@ -2560,7 +2560,7 @@ static void pplib_apply_display_requirements( · 2559 unmodified lines
25602560 dc->prev_display_config = *pp_display_cfg;
25612561 }
25622562
2563−void dce110_set_bandwidth(
2563+static void dce110_set_bandwidth(
25642564 struct dc *dc,
25652565 struct dc_state *context,
25662566 bool decrease_allowed)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h+0−5
@@ -68,11 +68,6 @@ void dce110_fill_display_configs( · 67 unmodified lines
6868 const struct dc_state *context,
6969 struct dm_pp_display_configuration *pp_display_cfg);
7070
71−void dce110_set_bandwidth(
72− struct dc *dc,
73− struct dc_state *context,
74− bool decrease_allowed);
75−
7671 uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context);
7772
7873 void dp_receiver_power_ctrl(struct dc_link *link, bool on);
drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.c+0−12
@@ -244,17 +244,6 @@ static void dce120_update_dchub( · 243 unmodified lines
244244 dh_data->dchub_info_valid = false;
245245 }
246246
247−static void dce120_set_bandwidth(
248− struct dc *dc,
249− struct dc_state *context,
250− bool decrease_allowed)
251−{
252− if (context->stream_count <= 0)
253− return;
254−
255− dce110_set_bandwidth(dc, context, decrease_allowed);
256−}
257−
258247 void dce120_hw_sequencer_construct(struct dc *dc)
259248 {
260249 /* All registers used by dce11.2 match those in dce11 in offset and
@@ -263,6 +252,5 @@ void dce120_hw_sequencer_construct(struct dc *dc) · 2 unmodified lines
263252 dce110_hw_sequencer_construct(dc);
264253 dc->hwss.enable_display_power_gating = dce120_enable_display_power_gating;
265254 dc->hwss.update_dchub = dce120_update_dchub;
266− dc->hwss.set_bandwidth = dce120_set_bandwidth;
267255 }
268256
drivers/gpu/drm/amd/include/kgd_kfd_interface.h+1−1
@@ -292,7 +292,7 @@ struct tile_config { · 291 unmodified lines
292292 struct kfd2kgd_calls {
293293 int (*init_gtt_mem_allocation)(struct kgd_dev *kgd, size_t size,
294294 void **mem_obj, uint64_t *gpu_addr,
295− void **cpu_ptr);
295+ void **cpu_ptr, bool mqd_gfx9);
296296
297297 void (*free_gtt_mem)(struct kgd_dev *kgd, void *mem_obj);
298298
drivers/gpu/drm/arm/malidp_drv.c+1−0
@@ -754,6 +754,7 @@ static int malidp_bind(struct device *dev) · 753 unmodified lines
754754 drm->irq_enabled = true;
755755
756756 ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
757+ drm_crtc_vblank_reset(&malidp->crtc);
757758 if (ret < 0) {
758759 DRM_ERROR("failed to initialise vblank\n");
759760 goto vblank_fail;
drivers/gpu/drm/arm/malidp_hw.c+23−2
@@ -384,7 +384,8 @@ static long malidp500_se_calc_mclk(struct malidp_hw_device *hwdev, · 383 unmodified lines
384384
385385 static int malidp500_enable_memwrite(struct malidp_hw_device *hwdev,
386386 dma_addr_t *addrs, s32 *pitches,
387− int num_planes, u16 w, u16 h, u32 fmt_id)
387+ int num_planes, u16 w, u16 h, u32 fmt_id,
388+ const s16 *rgb2yuv_coeffs)
388389 {
389390 u32 base = MALIDP500_SE_MEMWRITE_BASE;
390391 u32 de_base = malidp_get_block_base(hwdev, MALIDP_DE_BLOCK);
@@ -416,6 +417,16 @@ static int malidp500_enable_memwrite(struct malidp_hw_device *hwdev, · 25 unmodified lines
416417
417418 malidp_hw_write(hwdev, MALIDP_DE_H_ACTIVE(w) | MALIDP_DE_V_ACTIVE(h),
418419 MALIDP500_SE_MEMWRITE_OUT_SIZE);
420+
421+ if (rgb2yuv_coeffs) {
422+ int i;
423+
424+ for (i = 0; i < MALIDP_COLORADJ_NUM_COEFFS; i++) {
425+ malidp_hw_write(hwdev, rgb2yuv_coeffs[i],
426+ MALIDP500_SE_RGB_YUV_COEFFS + i * 4);
427+ }
428+ }
429+
419430 malidp_hw_setbits(hwdev, MALIDP_SE_MEMWRITE_EN, MALIDP500_SE_CONTROL);
420431
421432 return 0;
@@ -658,7 +669,8 @@ static long malidp550_se_calc_mclk(struct malidp_hw_device *hwdev, · 236 unmodified lines
658669
659670 static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,
660671 dma_addr_t *addrs, s32 *pitches,
661− int num_planes, u16 w, u16 h, u32 fmt_id)
672+ int num_planes, u16 w, u16 h, u32 fmt_id,
673+ const s16 *rgb2yuv_coeffs)
662674 {
663675 u32 base = MALIDP550_SE_MEMWRITE_BASE;
664676 u32 de_base = malidp_get_block_base(hwdev, MALIDP_DE_BLOCK);
@@ -689,6 +701,15 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev, · 24 unmodified lines
689701 malidp_hw_setbits(hwdev, MALIDP550_SE_MEMWRITE_ONESHOT | MALIDP_SE_MEMWRITE_EN,
690702 MALIDP550_SE_CONTROL);
691703
704+ if (rgb2yuv_coeffs) {
705+ int i;
706+
707+ for (i = 0; i < MALIDP_COLORADJ_NUM_COEFFS; i++) {
708+ malidp_hw_write(hwdev, rgb2yuv_coeffs[i],
709+ MALIDP550_SE_RGB_YUV_COEFFS + i * 4);
710+ }
711+ }
712+
692713 return 0;
693714 }
694715
drivers/gpu/drm/arm/malidp_hw.h+2−1
@@ -191,7 +191,8 @@ struct malidp_hw { · 190 unmodified lines
191191 * @param fmt_id - internal format ID of output buffer
192192 */
193193 int (*enable_memwrite)(struct malidp_hw_device *hwdev, dma_addr_t *addrs,
194− s32 *pitches, int num_planes, u16 w, u16 h, u32 fmt_id);
194+ s32 *pitches, int num_planes, u16 w, u16 h, u32 fmt_id,
195+ const s16 *rgb2yuv_coeffs);
195196
196197 /*
197198 * Disable the writing to memory of the next frame's content.
drivers/gpu/drm/arm/malidp_mw.c+21−4
@@ -26,6 +26,8 @@ struct malidp_mw_connector_state { · 25 unmodified lines
2626 s32 pitches[2];
2727 u8 format;
2828 u8 n_planes;
29+ bool rgb2yuv_initialized;
30+ const s16 *rgb2yuv_coeffs;
2931 };
3032
3133 static int malidp_mw_connector_get_modes(struct drm_connector *connector)
@@ -84,7 +86,7 @@ static void malidp_mw_connector_destroy(struct drm_connector *connector) · 52 unmodified lines
8486 static struct drm_connector_state *
8587 malidp_mw_connector_duplicate_state(struct drm_connector *connector)
8688 {
87− struct malidp_mw_connector_state *mw_state;
89+ struct malidp_mw_connector_state *mw_state, *mw_current_state;
8890
8991 if (WARN_ON(!connector->state))
9092 return NULL;
@@ -93,7 +95,10 @@ malidp_mw_connector_duplicate_state(struct drm_connector *connector) · 2 unmodified lines
9395 if (!mw_state)
9496 return NULL;
9597
96− /* No need to preserve any of our driver-local data */
98+ mw_current_state = to_mw_state(connector->state);
99+ mw_state->rgb2yuv_coeffs = mw_current_state->rgb2yuv_coeffs;
100+ mw_state->rgb2yuv_initialized = mw_current_state->rgb2yuv_initialized;
101+
97102 __drm_atomic_helper_connector_duplicate_state(connector, &mw_state->base);
98103
99104 return &mw_state->base;
@@ -108,6 +113,13 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = { · 8 unmodified lines
108113 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
109114 };
110115
116+static const s16 rgb2yuv_coeffs_bt709_limited[MALIDP_COLORADJ_NUM_COEFFS] = {
117+ 47, 157, 16,
118+ -26, -87, 112,
119+ 112, -102, -10,
120+ 16, 128, 128
121+};
122+
111123 static int
112124 malidp_mw_encoder_atomic_check(struct drm_encoder *encoder,
113125 struct drm_crtc_state *crtc_state,
@@ -157,6 +169,9 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder, · 43 unmodified lines
157169 }
158170 mw_state->n_planes = n_planes;
159171
172+ if (fb->format->is_yuv)
173+ mw_state->rgb2yuv_coeffs = rgb2yuv_coeffs_bt709_limited;
174+
160175 return 0;
161176 }
162177
@@ -239,10 +254,12 @@ void malidp_mw_atomic_commit(struct drm_device *drm, · 76 unmodified lines
239254
240255 drm_writeback_queue_job(mw_conn, conn_state->writeback_job);
241256 conn_state->writeback_job = NULL;
242−
243257 hwdev->hw->enable_memwrite(hwdev, mw_state->addrs,
244258 mw_state->pitches, mw_state->n_planes,
245− fb->width, fb->height, mw_state->format);
259+ fb->width, fb->height, mw_state->format,
260+ !mw_state->rgb2yuv_initialized ?
261+ mw_state->rgb2yuv_coeffs : NULL);
262+ mw_state->rgb2yuv_initialized = !!mw_state->rgb2yuv_coeffs;
246263 } else {
247264 DRM_DEV_DEBUG_DRIVER(drm->dev, "Disable memwrite\n");
248265 hwdev->hw->disable_memwrite(hwdev);
drivers/gpu/drm/arm/malidp_regs.h+2−0
@@ -205,6 +205,7 @@ · 204 unmodified lines
205205 #define MALIDP500_SE_BASE 0x00c00
206206 #define MALIDP500_SE_CONTROL 0x00c0c
207207 #define MALIDP500_SE_MEMWRITE_OUT_SIZE 0x00c2c
208+#define MALIDP500_SE_RGB_YUV_COEFFS 0x00C74
208209 #define MALIDP500_SE_MEMWRITE_BASE 0x00e00
209210 #define MALIDP500_DC_IRQ_BASE 0x00f00
210211 #define MALIDP500_CONFIG_VALID 0x00f00
@@ -238,6 +239,7 @@ · 27 unmodified lines
238239 #define MALIDP550_SE_CONTROL 0x08010
239240 #define MALIDP550_SE_MEMWRITE_ONESHOT (1 << 7)
240241 #define MALIDP550_SE_MEMWRITE_OUT_SIZE 0x08030
242+#define MALIDP550_SE_RGB_YUV_COEFFS 0x08078
241243 #define MALIDP550_SE_MEMWRITE_BASE 0x08100
242244 #define MALIDP550_DC_BASE 0x0c000
243245 #define MALIDP550_DC_CONTROL 0x0c010
drivers/gpu/drm/drm_atomic.c+1−1
@@ -2067,7 +2067,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p, · 2066 unmodified lines
20672067 struct drm_connector *connector;
20682068 struct drm_connector_list_iter conn_iter;
20692069
2070− if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
2070+ if (!drm_drv_uses_atomic_modeset(dev))
20712071 return;
20722072
20732073 list_for_each_entry(plane, &config->plane_list, head) {
drivers/gpu/drm/drm_debugfs.c+1−1
@@ -151,7 +151,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, · 150 unmodified lines
151151 return ret;
152152 }
153153
154− if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
154+ if (drm_drv_uses_atomic_modeset(dev)) {
155155 ret = drm_atomic_debugfs_init(minor);
156156 if (ret) {
157157 DRM_ERROR("Failed to create atomic debugfs files\n");
drivers/gpu/drm/drm_fb_helper.c+0−3
@@ -2370,7 +2370,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, · 2369 unmodified lines
23702370 {
23712371 int c, o;
23722372 struct drm_connector *connector;
2373− const struct drm_connector_helper_funcs *connector_funcs;
23742373 int my_score, best_score, score;
23752374 struct drm_fb_helper_crtc **crtcs, *crtc;
23762375 struct drm_fb_helper_connector *fb_helper_conn;
@@ -2399,8 +2398,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, · 22 unmodified lines
23992398 if (drm_has_preferred_mode(fb_helper_conn, width, height))
24002399 my_score++;
24012400
2402− connector_funcs = connector->helper_private;
2403−
24042401 /*
24052402 * select a crtc for this connector and then attempt to configure
24062403 * remaining connectors
drivers/gpu/drm/drm_panel.c+0−10
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <linux/err.h>
2525 #include <linux/module.h>
2626
27−#include <drm/drm_device.h>
2827 #include <drm/drm_crtc.h>
2928 #include <drm/drm_panel.h>
3029
@@ -105,13 +104,6 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) · 74 unmodified lines
105104 if (panel->connector)
106105 return -EBUSY;
107106
108− panel->link = device_link_add(connector->dev->dev, panel->dev, 0);
109− if (!panel->link) {
110− dev_err(panel->dev, "failed to link panel to %s\n",
111− dev_name(connector->dev->dev));
112− return -EINVAL;
113− }
114−
115107 panel->connector = connector;
116108 panel->drm = connector->dev;
117109
@@ -133,8 +125,6 @@ EXPORT_SYMBOL(drm_panel_attach); · 15 unmodified lines
133125 */
134126 int drm_panel_detach(struct drm_panel *panel)
135127 {
136− device_link_del(panel->link);
137−
138128 panel->connector = NULL;
139129 panel->drm = NULL;
140130
drivers/gpu/drm/drm_syncobj.c+5−0
@@ -97,6 +97,8 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, · 96 unmodified lines
9797 {
9898 int ret;
9999
100+ WARN_ON(*fence);
101+
100102 *fence = drm_syncobj_fence_get(syncobj);
101103 if (*fence)
102104 return 1;
@@ -743,6 +745,9 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, · 640 unmodified lines
743745
744746 if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {
745747 for (i = 0; i < count; ++i) {
748+ if (entries[i].fence)
749+ continue;
750+
746751 drm_syncobj_fence_get_or_add_callback(syncobjs[i],
747752 &entries[i].fence,
748753 &entries[i].syncobj_cb,
drivers/gpu/drm/etnaviv/etnaviv_drv.c+21−6
@@ -592,8 +592,6 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) · 591 unmodified lines
592592 struct device *dev = &pdev->dev;
593593 struct component_match *match = NULL;
594594
595− dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
596−
597595 if (!dev->platform_data) {
598596 struct device_node *core_node;
599597
@@ -655,13 +653,30 @@ static int __init etnaviv_init(void) · 55 unmodified lines
655653 for_each_compatible_node(np, NULL, "vivante,gc") {
656654 if (!of_device_is_available(np))
657655 continue;
658− pdev = platform_device_register_simple("etnaviv", -1,
659− NULL, 0);
660− if (IS_ERR(pdev)) {
661− ret = PTR_ERR(pdev);
656+
657+ pdev = platform_device_alloc("etnaviv", -1);
658+ if (!pdev) {
659+ ret = -ENOMEM;
660+ of_node_put(np);
661+ goto unregister_platform_driver;
662+ }
663+ pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40);
664+ pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
665+
666+ /*
667+ * Apply the same DMA configuration to the virtual etnaviv
668+ * device as the GPU we found. This assumes that all Vivante
669+ * GPUs in the system share the same DMA constraints.
670+ */
671+ of_dma_configure(&pdev->dev, np, true);
672+
673+ ret = platform_device_add(pdev);
674+ if (ret) {
675+ platform_device_put(pdev);
662676 of_node_put(np);
663677 goto unregister_platform_driver;
664678 }
679+
665680 etnaviv_drm = pdev;
666681 of_node_put(np);
667682 break;
drivers/gpu/drm/i915/gvt/dmabuf.c+26−7
@@ -170,20 +170,22 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev, · 169 unmodified lines
170170 unsigned int tiling_mode = 0;
171171 unsigned int stride = 0;
172172
173− switch (info->drm_format_mod << 10) {
174− case PLANE_CTL_TILED_LINEAR:
173+ switch (info->drm_format_mod) {
174+ case DRM_FORMAT_MOD_LINEAR:
175175 tiling_mode = I915_TILING_NONE;
176176 break;
177− case PLANE_CTL_TILED_X:
177+ case I915_FORMAT_MOD_X_TILED:
178178 tiling_mode = I915_TILING_X;
179179 stride = info->stride;
180180 break;
181− case PLANE_CTL_TILED_Y:
181+ case I915_FORMAT_MOD_Y_TILED:
182+ case I915_FORMAT_MOD_Yf_TILED:
182183 tiling_mode = I915_TILING_Y;
183184 stride = info->stride;
184185 break;
185186 default:
186− gvt_dbg_core("not supported tiling mode\n");
187+ gvt_dbg_core("invalid drm_format_mod %llx for tiling\n",
188+ info->drm_format_mod);
187189 }
188190 obj->tiling_and_stride = tiling_mode | stride;
189191 } else {
@@ -222,9 +224,26 @@ static int vgpu_get_plane_info(struct drm_device *dev, · 32 unmodified lines
222224 info->height = p.height;
223225 info->stride = p.stride;
224226 info->drm_format = p.drm_format;
225− info->drm_format_mod = p.tiled;
227+
228+ switch (p.tiled) {
229+ case PLANE_CTL_TILED_LINEAR:
230+ info->drm_format_mod = DRM_FORMAT_MOD_LINEAR;
231+ break;
232+ case PLANE_CTL_TILED_X:
233+ info->drm_format_mod = I915_FORMAT_MOD_X_TILED;
234+ break;
235+ case PLANE_CTL_TILED_Y:
236+ info->drm_format_mod = I915_FORMAT_MOD_Y_TILED;
237+ break;
238+ case PLANE_CTL_TILED_YF:
239+ info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED;
240+ break;
241+ default:
242+ gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled);
243+ }
244+
226245 info->size = (((p.stride * p.height * p.bpp) / 8) +
227− (PAGE_SIZE - 1)) >> PAGE_SHIFT;
246+ (PAGE_SIZE - 1)) >> PAGE_SHIFT;
228247 } else if (plane_id == DRM_PLANE_TYPE_CURSOR) {
229248 ret = intel_vgpu_decode_cursor_plane(vgpu, &c);
230249 if (ret)
drivers/gpu/drm/i915/gvt/fb_decoder.c+2−3
@@ -220,8 +220,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, · 219 unmodified lines
220220 if (IS_SKYLAKE(dev_priv)
221221 || IS_KABYLAKE(dev_priv)
222222 || IS_BROXTON(dev_priv)) {
223− plane->tiled = (val & PLANE_CTL_TILED_MASK) >>
224− _PLANE_CTL_TILED_SHIFT;
223+ plane->tiled = val & PLANE_CTL_TILED_MASK;
225224 fmt = skl_format_to_drm(
226225 val & PLANE_CTL_FORMAT_MASK,
227226 val & PLANE_CTL_ORDER_RGBX,
@@ -260,7 +259,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, · 32 unmodified lines
260259 return -EINVAL;
261260 }
262261
263− plane->stride = intel_vgpu_get_stride(vgpu, pipe, (plane->tiled << 10),
262+ plane->stride = intel_vgpu_get_stride(vgpu, pipe, plane->tiled,
264263 (IS_SKYLAKE(dev_priv)
265264 || IS_KABYLAKE(dev_priv)
266265 || IS_BROXTON(dev_priv)) ?
drivers/gpu/drm/i915/gvt/fb_decoder.h+1−1
@@ -101,7 +101,7 @@ struct intel_gvt; · 100 unmodified lines
101101 /* color space conversion and gamma correction are not included */
102102 struct intel_vgpu_primary_plane_format {
103103 u8 enabled; /* plane is enabled */
104− u8 tiled; /* X-tiled */
104+ u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */
105105 u8 bpp; /* bits per pixel */
106106 u32 hw_format; /* format field in the PRI_CTL register */
107107 u32 drm_format; /* format in DRM definition */
drivers/gpu/drm/i915/gvt/handlers.c+28−6
@@ -1296,6 +1296,19 @@ static int power_well_ctl_mmio_write(struct intel_vgpu *vgpu, · 1295 unmodified lines
12961296 return 0;
12971297 }
12981298
1299+static int gen9_dbuf_ctl_mmio_write(struct intel_vgpu *vgpu,
1300+ unsigned int offset, void *p_data, unsigned int bytes)
1301+{
1302+ write_vreg(vgpu, offset, p_data, bytes);
1303+
1304+ if (vgpu_vreg(vgpu, offset) & DBUF_POWER_REQUEST)
1305+ vgpu_vreg(vgpu, offset) |= DBUF_POWER_STATE;
1306+ else
1307+ vgpu_vreg(vgpu, offset) &= ~DBUF_POWER_STATE;
1308+
1309+ return 0;
1310+}
1311+
12991312 static int fpga_dbg_mmio_write(struct intel_vgpu *vgpu,
13001313 unsigned int offset, void *p_data, unsigned int bytes)
13011314 {
@@ -1525,9 +1538,15 @@ static int bxt_phy_ctl_family_write(struct intel_vgpu *vgpu, · 223 unmodified lines
15251538 u32 v = *(u32 *)p_data;
15261539 u32 data = v & COMMON_RESET_DIS ? BXT_PHY_LANE_ENABLED : 0;
15271540
1528− vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_A) = data;
1529− vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_B) = data;
1530− vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_C) = data;
1541+ switch (offset) {
1542+ case _PHY_CTL_FAMILY_EDP:
1543+ vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_A) = data;
1544+ break;
1545+ case _PHY_CTL_FAMILY_DDI:
1546+ vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_B) = data;
1547+ vgpu_vreg(vgpu, _BXT_PHY_CTL_DDI_C) = data;
1548+ break;
1549+ }
15311550
15321551 vgpu_vreg(vgpu, offset) = v;
15331552
@@ -2812,6 +2831,8 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 1278 unmodified lines
28122831 MMIO_DH(HSW_PWR_WELL_CTL_DRIVER(SKL_DISP_PW_MISC_IO), D_SKL_PLUS, NULL,
28132832 skl_power_well_ctl_write);
28142833
2834+ MMIO_DH(DBUF_CTL, D_SKL_PLUS, NULL, gen9_dbuf_ctl_mmio_write);
2835+
28152836 MMIO_D(_MMIO(0xa210), D_SKL_PLUS);
28162837 MMIO_D(GEN9_MEDIA_PG_IDLE_HYSTERESIS, D_SKL_PLUS);
28172838 MMIO_D(GEN9_RENDER_PG_IDLE_HYSTERESIS, D_SKL_PLUS);
@@ -2987,8 +3008,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 169 unmodified lines
29873008 NULL, gen9_trtte_write);
29883009 MMIO_DH(_MMIO(0x4dfc), D_SKL_PLUS, NULL, gen9_trtt_chicken_write);
29893010
2990− MMIO_D(_MMIO(0x45008), D_SKL_PLUS);
2991−
29923011 MMIO_D(_MMIO(0x46430), D_SKL_PLUS);
29933012
29943013 MMIO_D(_MMIO(0x46520), D_SKL_PLUS);
@@ -3025,7 +3044,9 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 30 unmodified lines
30253044 MMIO_D(_MMIO(0x44500), D_SKL_PLUS);
30263045 MMIO_DFH(GEN9_CSFE_CHICKEN1_RCS, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL);
30273046 MMIO_DFH(GEN8_HDC_CHICKEN1, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS,
3028− NULL, NULL);
3047+ NULL, NULL);
3048+ MMIO_DFH(GEN9_WM_CHICKEN3, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS,
3049+ NULL, NULL);
30293050
30303051 MMIO_D(_MMIO(0x4ab8), D_KBL);
30313052 MMIO_D(_MMIO(0x2248), D_KBL | D_SKL);
@@ -3189,6 +3210,7 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt) · 157 unmodified lines
31893210 MMIO_D(BXT_DSI_PLL_ENABLE, D_BXT);
31903211
31913212 MMIO_D(GEN9_CLKGATE_DIS_0, D_BXT);
3213+ MMIO_D(GEN9_CLKGATE_DIS_4, D_BXT);
31923214
31933215 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_A), D_BXT);
31943216 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_B), D_BXT);
drivers/gpu/drm/i915/gvt/kvmgt.c+14−3
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include <linux/device.h>
3333 #include <linux/mm.h>
3434 #include <linux/mmu_context.h>
35+#include <linux/sched/mm.h>
3536 #include <linux/types.h>
3637 #include <linux/list.h>
3738 #include <linux/rbtree.h>
@@ -1792,16 +1793,21 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 1754 unmodified lines
17921793 info = (struct kvmgt_guest_info *)handle;
17931794 kvm = info->kvm;
17941795
1795− if (kthread)
1796+ if (kthread) {
1797+ if (!mmget_not_zero(kvm->mm))
1798+ return -EFAULT;
17961799 use_mm(kvm->mm);
1800+ }
17971801
17981802 idx = srcu_read_lock(&kvm->srcu);
17991803 ret = write ? kvm_write_guest(kvm, gpa, buf, len) :
18001804 kvm_read_guest(kvm, gpa, buf, len);
18011805 srcu_read_unlock(&kvm->srcu, idx);
18021806
1803− if (kthread)
1807+ if (kthread) {
18041808 unuse_mm(kvm->mm);
1809+ mmput(kvm->mm);
1810+ }
18051811
18061812 return ret;
18071813 }
@@ -1827,6 +1833,8 @@ static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn) · 19 unmodified lines
18271833 {
18281834 struct kvmgt_guest_info *info;
18291835 struct kvm *kvm;
1836+ int idx;
1837+ bool ret;
18301838
18311839 if (!handle_valid(handle))
18321840 return false;
@@ -1834,8 +1842,11 @@ static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn) · 1 unmodified line
18341842 info = (struct kvmgt_guest_info *)handle;
18351843 kvm = info->kvm;
18361844
1837− return kvm_is_visible_gfn(kvm, gfn);
1845+ idx = srcu_read_lock(&kvm->srcu);
1846+ ret = kvm_is_visible_gfn(kvm, gfn);
1847+ srcu_read_unlock(&kvm->srcu, idx);
18381848
1849+ return ret;
18391850 }
18401851
18411852 struct intel_gvt_mpt kvmgt_mpt = {
drivers/gpu/drm/i915/gvt/mmio.c+28−0
@@ -244,6 +244,34 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu, bool dmlr) · 243 unmodified lines
244244
245245 /* set the bit 0:2(Core C-State ) to C0 */
246246 vgpu_vreg_t(vgpu, GEN6_GT_CORE_STATUS) = 0;
247+
248+ if (IS_BROXTON(vgpu->gvt->dev_priv)) {
249+ vgpu_vreg_t(vgpu, BXT_P_CR_GT_DISP_PWRON) &=
250+ ~(BIT(0) | BIT(1));
251+ vgpu_vreg_t(vgpu, BXT_PORT_CL1CM_DW0(DPIO_PHY0)) &=
252+ ~PHY_POWER_GOOD;
253+ vgpu_vreg_t(vgpu, BXT_PORT_CL1CM_DW0(DPIO_PHY1)) &=
254+ ~PHY_POWER_GOOD;
255+ vgpu_vreg_t(vgpu, BXT_PHY_CTL_FAMILY(DPIO_PHY0)) &=
256+ ~BIT(30);
257+ vgpu_vreg_t(vgpu, BXT_PHY_CTL_FAMILY(DPIO_PHY1)) &=
258+ ~BIT(30);
259+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_A)) &=
260+ ~BXT_PHY_LANE_ENABLED;
261+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_A)) |=
262+ BXT_PHY_CMNLANE_POWERDOWN_ACK |
263+ BXT_PHY_LANE_POWERDOWN_ACK;
264+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_B)) &=
265+ ~BXT_PHY_LANE_ENABLED;
266+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_B)) |=
267+ BXT_PHY_CMNLANE_POWERDOWN_ACK |
268+ BXT_PHY_LANE_POWERDOWN_ACK;
269+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_C)) &=
270+ ~BXT_PHY_LANE_ENABLED;
271+ vgpu_vreg_t(vgpu, BXT_PHY_CTL(PORT_C)) |=
272+ BXT_PHY_CMNLANE_POWERDOWN_ACK |
273+ BXT_PHY_LANE_POWERDOWN_ACK;
274+ }
247275 } else {
248276 #define GVT_GEN8_MMIO_RESET_OFFSET (0x44200)
249277 /* only reset the engine related, so starting with 0x44200
drivers/gpu/drm/i915/gvt/mmio_context.c+0−2
@@ -562,11 +562,9 @@ void intel_gvt_switch_mmio(struct intel_vgpu *pre, · 561 unmodified lines
562562 * performace for batch mmio read/write, so we need
563563 * handle forcewake mannually.
564564 */
565− intel_runtime_pm_get(dev_priv);
566565 intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
567566 switch_mmio(pre, next, ring_id);
568567 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
569− intel_runtime_pm_put(dev_priv);
570568 }
571569
572570 /**
drivers/gpu/drm/i915/gvt/opregion.c+9−11
@@ -42,8 +42,6 @@ · 41 unmodified lines
4242 #define DEVICE_TYPE_EFP3 0x20
4343 #define DEVICE_TYPE_EFP4 0x10
4444
45−#define DEV_SIZE 38
46−
4745 struct opregion_header {
4846 u8 signature[16];
4947 u32 size;
@@ -63,6 +61,10 @@ struct bdb_data_header { · 13 unmodified lines
6361 u16 size; /* data size */
6462 } __packed;
6563
64+/* For supporting windows guest with opregion, here hardcode the emulated
65+ * bdb header version as '186', and the corresponding child_device_config
66+ * length should be '33' but not '38'.
67+ */
6668 struct efp_child_device_config {
6769 u16 handle;
6870 u16 device_type;
@@ -109,12 +111,6 @@ struct efp_child_device_config { · 40 unmodified lines
109111 u8 mipi_bridge_type; /* 171 */
110112 u16 device_class_ext;
111113 u8 dvo_function;
112− u8 dp_usb_type_c:1; /* 195 */
113− u8 skip6:7;
114− u8 dp_usb_type_c_2x_gpio_index; /* 195 */
115− u16 dp_usb_type_c_2x_gpio_pin; /* 195 */
116− u8 iboost_dp:4; /* 196 */
117− u8 iboost_hdmi:4; /* 196 */
118114 } __packed;
119115
120116 struct vbt {
@@ -155,7 +151,7 @@ static void virt_vbt_generation(struct vbt *v) · 34 unmodified lines
155151 v->header.bdb_offset = offsetof(struct vbt, bdb_header);
156152
157153 strcpy(&v->bdb_header.signature[0], "BIOS_DATA_BLOCK");
158− v->bdb_header.version = 186; /* child_dev_size = 38 */
154+ v->bdb_header.version = 186; /* child_dev_size = 33 */
159155 v->bdb_header.header_size = sizeof(v->bdb_header);
160156
161157 v->bdb_header.bdb_size = sizeof(struct vbt) - sizeof(struct vbt_header)
@@ -169,11 +165,13 @@ static void virt_vbt_generation(struct vbt *v) · 7 unmodified lines
169165
170166 /* child device */
171167 num_child = 4; /* each port has one child */
168+ v->general_definitions.child_dev_size =
169+ sizeof(struct efp_child_device_config);
172170 v->general_definitions_header.id = BDB_GENERAL_DEFINITIONS;
173171 /* size will include child devices */
174172 v->general_definitions_header.size =
175− sizeof(struct bdb_general_definitions) + num_child * DEV_SIZE;
176− v->general_definitions.child_dev_size = DEV_SIZE;
173+ sizeof(struct bdb_general_definitions) +
174+ num_child * v->general_definitions.child_dev_size;
177175
178176 /* portA */
179177 v->child0.handle = DEVICE_TYPE_EFP1;
drivers/gpu/drm/i915/gvt/sched_policy.c+30−7
@@ -47,11 +47,15 @@ static bool vgpu_has_pending_workload(struct intel_vgpu *vgpu) · 46 unmodified lines
4747 return false;
4848 }
4949
50+/* We give 2 seconds higher prio for vGPU during start */
51+#define GVT_SCHED_VGPU_PRI_TIME 2
52+
5053 struct vgpu_sched_data {
5154 struct list_head lru_list;
5255 struct intel_vgpu *vgpu;
5356 bool active;
54−
57+ bool pri_sched;
58+ ktime_t pri_time;
5559 ktime_t sched_in_time;
5660 ktime_t sched_time;
5761 ktime_t left_ts;
@@ -183,6 +187,14 @@ static struct intel_vgpu *find_busy_vgpu(struct gvt_sched_data *sched_data) · 125 unmodified lines
183187 if (!vgpu_has_pending_workload(vgpu_data->vgpu))
184188 continue;
185189
190+ if (vgpu_data->pri_sched) {
191+ if (ktime_before(ktime_get(), vgpu_data->pri_time)) {
192+ vgpu = vgpu_data->vgpu;
193+ break;
194+ } else
195+ vgpu_data->pri_sched = false;
196+ }
197+
186198 /* Return the vGPU only if it has time slice left */
187199 if (vgpu_data->left_ts > 0) {
188200 vgpu = vgpu_data->vgpu;
@@ -202,6 +214,7 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data) · 13 unmodified lines
202214 struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
203215 struct vgpu_sched_data *vgpu_data;
204216 struct intel_vgpu *vgpu = NULL;
217+
205218 /* no active vgpu or has already had a target */
206219 if (list_empty(&sched_data->lru_runq_head) || scheduler->next_vgpu)
207220 goto out;
@@ -209,12 +222,13 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data) · 1 unmodified line
209222 vgpu = find_busy_vgpu(sched_data);
210223 if (vgpu) {
211224 scheduler->next_vgpu = vgpu;
212−
213− /* Move the last used vGPU to the tail of lru_list */
214225 vgpu_data = vgpu->sched_data;
215− list_del_init(&vgpu_data->lru_list);
216− list_add_tail(&vgpu_data->lru_list,
217− &sched_data->lru_runq_head);
226+ if (!vgpu_data->pri_sched) {
227+ /* Move the last used vGPU to the tail of lru_list */
228+ list_del_init(&vgpu_data->lru_list);
229+ list_add_tail(&vgpu_data->lru_list,
230+ &sched_data->lru_runq_head);
231+ }
218232 } else {
219233 scheduler->next_vgpu = gvt->idle_vgpu;
220234 }
@@ -328,11 +342,17 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu) · 107 unmodified lines
328342 {
329343 struct gvt_sched_data *sched_data = vgpu->gvt->scheduler.sched_data;
330344 struct vgpu_sched_data *vgpu_data = vgpu->sched_data;
345+ ktime_t now;
331346
332347 if (!list_empty(&vgpu_data->lru_list))
333348 return;
334349
335− list_add_tail(&vgpu_data->lru_list, &sched_data->lru_runq_head);
350+ now = ktime_get();
351+ vgpu_data->pri_time = ktime_add(now,
352+ ktime_set(GVT_SCHED_VGPU_PRI_TIME, 0));
353+ vgpu_data->pri_sched = true;
354+
355+ list_add(&vgpu_data->lru_list, &sched_data->lru_runq_head);
336356
337357 if (!hrtimer_active(&sched_data->timer))
338358 hrtimer_start(&sched_data->timer, ktime_add_ns(ktime_get(),
@@ -426,6 +446,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) · 87 unmodified lines
426446 &vgpu->gvt->scheduler;
427447 int ring_id;
428448 struct vgpu_sched_data *vgpu_data = vgpu->sched_data;
449+ struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
429450
430451 if (!vgpu_data->active)
431452 return;
@@ -444,6 +465,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) · 12 unmodified lines
444465 scheduler->current_vgpu = NULL;
445466 }
446467
468+ intel_runtime_pm_get(dev_priv);
447469 spin_lock_bh(&scheduler->mmio_context_lock);
448470 for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) {
449471 if (scheduler->engine_owner[ring_id] == vgpu) {
@@ -452,5 +474,6 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu) · 2 unmodified lines
452474 }
453475 }
454476 spin_unlock_bh(&scheduler->mmio_context_lock);
477+ intel_runtime_pm_put(dev_priv);
455478 mutex_unlock(&vgpu->gvt->sched_lock);
456479 }
drivers/gpu/drm/i915/gvt/vgpu.c+1−0
@@ -281,6 +281,7 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu) · 280 unmodified lines
281281 intel_vgpu_clean_submission(vgpu);
282282 intel_vgpu_clean_display(vgpu);
283283 intel_vgpu_clean_opregion(vgpu);
284+ intel_vgpu_reset_ggtt(vgpu, true);
284285 intel_vgpu_clean_gtt(vgpu);
285286 intel_gvt_hypervisor_detach_vgpu(vgpu);
286287 intel_vgpu_free_resource(vgpu);
drivers/gpu/drm/i915/i915_reg.h+2−2
@@ -10422,7 +10422,7 @@ enum skl_power_gate { · 10421 unmodified lines
1042210422 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \
1042310423 _ICL_DSC0_PICTURE_PARAMETER_SET_4_PC)
1042410424 #define ICL_DSC1_PICTURE_PARAMETER_SET_4(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
10425− _ICL_DSC0_PICTURE_PARAMETER_SET_4_PB, \
10425+ _ICL_DSC1_PICTURE_PARAMETER_SET_4_PB, \
1042610426 _ICL_DSC1_PICTURE_PARAMETER_SET_4_PC)
1042710427 #define DSC_INITIAL_DEC_DELAY(dec_delay) ((dec_delay) << 16)
1042810428 #define DSC_INITIAL_XMIT_DELAY(xmit_delay) ((xmit_delay) << 0)
@@ -10437,7 +10437,7 @@ enum skl_power_gate { · 8 unmodified lines
1043710437 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PB, \
1043810438 _ICL_DSC0_PICTURE_PARAMETER_SET_5_PC)
1043910439 #define ICL_DSC1_PICTURE_PARAMETER_SET_5(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
10440− _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC, \
10440+ _ICL_DSC1_PICTURE_PARAMETER_SET_5_PB, \
1044110441 _ICL_DSC1_PICTURE_PARAMETER_SET_5_PC)
1044210442 #define DSC_SCALE_DEC_INTINT(scale_dec) ((scale_dec) << 16)
1044310443 #define DSC_SCALE_INC_INT(scale_inc) ((scale_inc) << 0)
drivers/gpu/drm/i915/intel_ddi.c+9−8
@@ -2708,7 +2708,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder, · 2707 unmodified lines
27082708 if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
27092709 intel_dp_stop_link_train(intel_dp);
27102710
2711− intel_ddi_enable_pipe_clock(crtc_state);
2711+ if (!is_mst)
2712+ intel_ddi_enable_pipe_clock(crtc_state);
27122713 }
27132714
27142715 static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
@@ -2810,14 +2811,14 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder, · 95 unmodified lines
28102811 bool is_mst = intel_crtc_has_type(old_crtc_state,
28112812 INTEL_OUTPUT_DP_MST);
28122813
2813− intel_ddi_disable_pipe_clock(old_crtc_state);
2814−
2815− /*
2816− * Power down sink before disabling the port, otherwise we end
2817− * up getting interrupts from the sink on detecting link loss.
2818− */
2819− if (!is_mst)
2814+ if (!is_mst) {
2815+ intel_ddi_disable_pipe_clock(old_crtc_state);
2816+ /*
2817+ * Power down sink before disabling the port, otherwise we end
2818+ * up getting interrupts from the sink on detecting link loss.
2819+ */
28202820 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
2821+ }
28212822
28222823 intel_disable_ddi_buf(encoder);
28232824
drivers/gpu/drm/i915/intel_display.c+6−2
@@ -5079,10 +5079,14 @@ void hsw_disable_ips(const struct intel_crtc_state *crtc_state) · 5078 unmodified lines
50795079 mutex_lock(&dev_priv->pcu_lock);
50805080 WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
50815081 mutex_unlock(&dev_priv->pcu_lock);
5082− /* wait for pcode to finish disabling IPS, which may take up to 42ms */
5082+ /*
5083+ * Wait for PCODE to finish disabling IPS. The BSpec specified
5084+ * 42ms timeout value leads to occasional timeouts so use 100ms
5085+ * instead.
5086+ */
50835087 if (intel_wait_for_register(dev_priv,
50845088 IPS_CTL, IPS_ENABLE, 0,
5085− 42))
5089+ 100))
50865090 DRM_ERROR("Timed out waiting for IPS disable\n");
50875091 } else {
50885092 I915_WRITE(IPS_CTL, 0);
drivers/gpu/drm/i915/intel_dp.c+19−14
@@ -4160,18 +4160,6 @@ intel_dp_needs_link_retrain(struct intel_dp *intel_dp) · 4159 unmodified lines
41604160 return !drm_dp_channel_eq_ok(link_status, intel_dp->lane_count);
41614161 }
41624162
4163−/*
4164− * If display is now connected check links status,
4165− * there has been known issues of link loss triggering
4166− * long pulse.
4167− *
4168− * Some sinks (eg. ASUS PB287Q) seem to perform some
4169− * weird HPD ping pong during modesets. So we can apparently
4170− * end up with HPD going low during a modeset, and then
4171− * going back up soon after. And once that happens we must
4172− * retrain the link to get a picture. That's in case no
4173− * userspace component reacted to intermittent HPD dip.
4174− */
41754163 int intel_dp_retrain_link(struct intel_encoder *encoder,
41764164 struct drm_modeset_acquire_ctx *ctx)
41774165 {
@@ -4661,7 +4649,8 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) · 483 unmodified lines
46614649 }
46624650
46634651 static int
4664−intel_dp_long_pulse(struct intel_connector *connector)
4652+intel_dp_long_pulse(struct intel_connector *connector,
4653+ struct drm_modeset_acquire_ctx *ctx)
46654654 {
46664655 struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
46674656 struct intel_dp *intel_dp = intel_attached_dp(&connector->base);
@@ -4720,6 +4709,22 @@ intel_dp_long_pulse(struct intel_connector *connector) · 52 unmodified lines
47204709 */
47214710 status = connector_status_disconnected;
47224711 goto out;
4712+ } else {
4713+ /*
4714+ * If display is now connected check links status,
4715+ * there has been known issues of link loss triggering
4716+ * long pulse.
4717+ *
4718+ * Some sinks (eg. ASUS PB287Q) seem to perform some
4719+ * weird HPD ping pong during modesets. So we can apparently
4720+ * end up with HPD going low during a modeset, and then
4721+ * going back up soon after. And once that happens we must
4722+ * retrain the link to get a picture. That's in case no
4723+ * userspace component reacted to intermittent HPD dip.
4724+ */
4725+ struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
4726+
4727+ intel_dp_retrain_link(encoder, ctx);
47234728 }
47244729
47254730 /*
@@ -4781,7 +4786,7 @@ intel_dp_detect(struct drm_connector *connector, · 55 unmodified lines
47814786 return ret;
47824787 }
47834788
4784− status = intel_dp_long_pulse(intel_dp->attached_connector);
4789+ status = intel_dp_long_pulse(intel_dp->attached_connector, ctx);
47854790 }
47864791
47874792 intel_dp->detect_done = false;
drivers/gpu/drm/i915/intel_dp_mst.c+4−0
@@ -166,6 +166,8 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder, · 165 unmodified lines
166166 struct intel_connector *connector =
167167 to_intel_connector(old_conn_state->connector);
168168
169+ intel_ddi_disable_pipe_clock(old_crtc_state);
170+
169171 /* this can fail */
170172 drm_dp_check_act_status(&intel_dp->mst_mgr);
171173 /* and this can also fail */
@@ -252,6 +254,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder, · 80 unmodified lines
252254 I915_WRITE(DP_TP_STATUS(port), temp);
253255
254256 ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
257+
258+ intel_ddi_enable_pipe_clock(pipe_config);
255259 }
256260
257261 static void intel_mst_enable_dp(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_overlay.c+75−153
@@ -181,8 +181,9 @@ struct intel_overlay { · 180 unmodified lines
181181 u32 brightness, contrast, saturation;
182182 u32 old_xscale, old_yscale;
183183 /* register access */
184− u32 flip_addr;
185184 struct drm_i915_gem_object *reg_bo;
185+ struct overlay_registers __iomem *regs;
186+ u32 flip_addr;
186187 /* flip handling */
187188 struct i915_gem_active last_flip;
188189 };
@@ -210,29 +211,6 @@ static void i830_overlay_clock_gating(struct drm_i915_private *dev_priv, · 21 unmodified lines
210211 PCI_DEVFN(0, 0), I830_CLOCK_GATE, val);
211212 }
212213
213−static struct overlay_registers __iomem *
214−intel_overlay_map_regs(struct intel_overlay *overlay)
215−{
216− struct drm_i915_private *dev_priv = overlay->i915;
217− struct overlay_registers __iomem *regs;
218−
219− if (OVERLAY_NEEDS_PHYSICAL(dev_priv))
220− regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_handle->vaddr;
221− else
222− regs = io_mapping_map_wc(&dev_priv->ggtt.iomap,
223− overlay->flip_addr,
224− PAGE_SIZE);
225−
226− return regs;
227−}
228−
229−static void intel_overlay_unmap_regs(struct intel_overlay *overlay,
230− struct overlay_registers __iomem *regs)
231−{
232− if (!OVERLAY_NEEDS_PHYSICAL(overlay->i915))
233− io_mapping_unmap(regs);
234−}
235−
236214 static void intel_overlay_submit_request(struct intel_overlay *overlay,
237215 struct i915_request *rq,
238216 i915_gem_retire_fn retire)
@@ -784,13 +762,13 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, · 545 unmodified lines
784762 struct drm_i915_gem_object *new_bo,
785763 struct put_image_params *params)
786764 {
787− int ret, tmp_width;
788− struct overlay_registers __iomem *regs;
789− bool scale_changed = false;
765+ struct overlay_registers __iomem *regs = overlay->regs;
790766 struct drm_i915_private *dev_priv = overlay->i915;
791767 u32 swidth, swidthsw, sheight, ostride;
792768 enum pipe pipe = overlay->crtc->pipe;
769+ bool scale_changed = false;
793770 struct i915_vma *vma;
771+ int ret, tmp_width;
794772
795773 lockdep_assert_held(&dev_priv->drm.struct_mutex);
796774 WARN_ON(!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
@@ -815,30 +793,19 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, · 18 unmodified lines
815793
816794 if (!overlay->active) {
817795 u32 oconfig;
818− regs = intel_overlay_map_regs(overlay);
819− if (!regs) {
820− ret = -ENOMEM;
821− goto out_unpin;
822− }
796+
823797 oconfig = OCONF_CC_OUT_8BIT;
824798 if (IS_GEN4(dev_priv))
825799 oconfig |= OCONF_CSC_MODE_BT709;
826800 oconfig |= pipe == 0 ?
827801 OCONF_PIPE_A : OCONF_PIPE_B;
828802 iowrite32(oconfig, &regs->OCONFIG);
829− intel_overlay_unmap_regs(overlay, regs);
830803
831804 ret = intel_overlay_on(overlay);
832805 if (ret != 0)
833806 goto out_unpin;
834807 }
835808
836− regs = intel_overlay_map_regs(overlay);
837− if (!regs) {
838− ret = -ENOMEM;
839− goto out_unpin;
840− }
841−
842809 iowrite32((params->dst_y << 16) | params->dst_x, &regs->DWINPOS);
843810 iowrite32((params->dst_h << 16) | params->dst_w, &regs->DWINSZ);
844811
@@ -882,8 +849,6 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, · 37 unmodified lines
882849
883850 iowrite32(overlay_cmd_reg(params), &regs->OCMD);
884851
885− intel_overlay_unmap_regs(overlay, regs);
886−
887852 ret = intel_overlay_continue(overlay, vma, scale_changed);
888853 if (ret)
889854 goto out_unpin;
@@ -901,7 +866,6 @@ out_pin_section: · 11 unmodified lines
901866 int intel_overlay_switch_off(struct intel_overlay *overlay)
902867 {
903868 struct drm_i915_private *dev_priv = overlay->i915;
904− struct overlay_registers __iomem *regs;
905869 int ret;
906870
907871 lockdep_assert_held(&dev_priv->drm.struct_mutex);
@@ -918,9 +882,7 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) · 10 unmodified lines
918882 if (ret != 0)
919883 return ret;
920884
921− regs = intel_overlay_map_regs(overlay);
922− iowrite32(0, &regs->OCMD);
923− intel_overlay_unmap_regs(overlay, regs);
885+ iowrite32(0, &overlay->regs->OCMD);
924886
925887 return intel_overlay_off(overlay);
926888 }
@@ -1305,7 +1267,6 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data, · 378 unmodified lines
13051267 struct drm_intel_overlay_attrs *attrs = data;
13061268 struct drm_i915_private *dev_priv = to_i915(dev);
13071269 struct intel_overlay *overlay;
1308− struct overlay_registers __iomem *regs;
13091270 int ret;
13101271
13111272 overlay = dev_priv->overlay;
@@ -1345,15 +1306,7 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data, · 33 unmodified lines
13451306 overlay->contrast = attrs->contrast;
13461307 overlay->saturation = attrs->saturation;
13471308
1348− regs = intel_overlay_map_regs(overlay);
1349− if (!regs) {
1350− ret = -ENOMEM;
1351− goto out_unlock;
1352− }
1353−
1354− update_reg_attrs(overlay, regs);
1355−
1356− intel_overlay_unmap_regs(overlay, regs);
1309+ update_reg_attrs(overlay, overlay->regs);
13571310
13581311 if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) {
13591312 if (IS_GEN2(dev_priv))
@@ -1386,12 +1339,47 @@ out_unlock: · 26 unmodified lines
13861339 return ret;
13871340 }
13881341
1342+static int get_registers(struct intel_overlay *overlay, bool use_phys)
1343+{
1344+ struct drm_i915_gem_object *obj;
1345+ struct i915_vma *vma;
1346+ int err;
1347+
1348+ obj = i915_gem_object_create_stolen(overlay->i915, PAGE_SIZE);
1349+ if (obj == NULL)
1350+ obj = i915_gem_object_create_internal(overlay->i915, PAGE_SIZE);
1351+ if (IS_ERR(obj))
1352+ return PTR_ERR(obj);
1353+
1354+ vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, PIN_MAPPABLE);
1355+ if (IS_ERR(vma)) {
1356+ err = PTR_ERR(vma);
1357+ goto err_put_bo;
1358+ }
1359+
1360+ if (use_phys)
1361+ overlay->flip_addr = sg_dma_address(obj->mm.pages->sgl);
1362+ else
1363+ overlay->flip_addr = i915_ggtt_offset(vma);
1364+ overlay->regs = i915_vma_pin_iomap(vma);
1365+ i915_vma_unpin(vma);
1366+
1367+ if (IS_ERR(overlay->regs)) {
1368+ err = PTR_ERR(overlay->regs);
1369+ goto err_put_bo;
1370+ }
1371+
1372+ overlay->reg_bo = obj;
1373+ return 0;
1374+
1375+err_put_bo:
1376+ i915_gem_object_put(obj);
1377+ return err;
1378+}
1379+
13891380 void intel_setup_overlay(struct drm_i915_private *dev_priv)
13901381 {
13911382 struct intel_overlay *overlay;
1392− struct drm_i915_gem_object *reg_bo;
1393− struct overlay_registers __iomem *regs;
1394− struct i915_vma *vma = NULL;
13951383 int ret;
13961384
13971385 if (!HAS_OVERLAY(dev_priv))
@@ -1401,46 +1389,8 @@ void intel_setup_overlay(struct drm_i915_private *dev_priv) · 3 unmodified lines
14011389 if (!overlay)
14021390 return;
14031391
1404− mutex_lock(&dev_priv->drm.struct_mutex);
1405− if (WARN_ON(dev_priv->overlay))
1406− goto out_free;
1407−
14081392 overlay->i915 = dev_priv;
14091393
1410− reg_bo = NULL;
1411− if (!OVERLAY_NEEDS_PHYSICAL(dev_priv))
1412− reg_bo = i915_gem_object_create_stolen(dev_priv, PAGE_SIZE);
1413− if (reg_bo == NULL)
1414− reg_bo = i915_gem_object_create(dev_priv, PAGE_SIZE);
1415− if (IS_ERR(reg_bo))
1416− goto out_free;
1417− overlay->reg_bo = reg_bo;
1418−
1419− if (OVERLAY_NEEDS_PHYSICAL(dev_priv)) {
1420− ret = i915_gem_object_attach_phys(reg_bo, PAGE_SIZE);
1421− if (ret) {
1422− DRM_ERROR("failed to attach phys overlay regs\n");
1423− goto out_free_bo;
1424− }
1425− overlay->flip_addr = reg_bo->phys_handle->busaddr;
1426− } else {
1427− vma = i915_gem_object_ggtt_pin(reg_bo, NULL,
1428− 0, PAGE_SIZE, PIN_MAPPABLE);
1429− if (IS_ERR(vma)) {
1430− DRM_ERROR("failed to pin overlay register bo\n");
1431− ret = PTR_ERR(vma);
1432− goto out_free_bo;
1433− }
1434− overlay->flip_addr = i915_ggtt_offset(vma);
1435−
1436− ret = i915_gem_object_set_to_gtt_domain(reg_bo, true);
1437− if (ret) {
1438− DRM_ERROR("failed to move overlay register bo into the GTT\n");
1439− goto out_unpin_bo;
1440− }
1441− }
1442−
1443− /* init all values */
14441394 overlay->color_key = 0x0101fe;
14451395 overlay->color_key_enabled = true;
14461396 overlay->brightness = -19;
@@ -1449,44 +1399,51 @@ void intel_setup_overlay(struct drm_i915_private *dev_priv) · 2 unmodified lines
14491399
14501400 init_request_active(&overlay->last_flip, NULL);
14511401
1452− regs = intel_overlay_map_regs(overlay);
1453− if (!regs)
1454− goto out_unpin_bo;
1402+ mutex_lock(&dev_priv->drm.struct_mutex);
1403+
1404+ ret = get_registers(overlay, OVERLAY_NEEDS_PHYSICAL(dev_priv));
1405+ if (ret)
1406+ goto out_free;
1407+
1408+ ret = i915_gem_object_set_to_gtt_domain(overlay->reg_bo, true);
1409+ if (ret)
1410+ goto out_reg_bo;
14551411
1456− memset_io(regs, 0, sizeof(struct overlay_registers));
1457− update_polyphase_filter(regs);
1458− update_reg_attrs(overlay, regs);
1412+ mutex_unlock(&dev_priv->drm.struct_mutex);
14591413
1460− intel_overlay_unmap_regs(overlay, regs);
1414+ memset_io(overlay->regs, 0, sizeof(struct overlay_registers));
1415+ update_polyphase_filter(overlay->regs);
1416+ update_reg_attrs(overlay, overlay->regs);
14611417
14621418 dev_priv->overlay = overlay;
1463− mutex_unlock(&dev_priv->drm.struct_mutex);
1464− DRM_INFO("initialized overlay support\n");
1419+ DRM_INFO("Initialized overlay support.\n");
14651420 return;
14661421
1467−out_unpin_bo:
1468− if (vma)
1469− i915_vma_unpin(vma);
1470−out_free_bo:
1471− i915_gem_object_put(reg_bo);
1422+out_reg_bo:
1423+ i915_gem_object_put(overlay->reg_bo);
14721424 out_free:
14731425 mutex_unlock(&dev_priv->drm.struct_mutex);
14741426 kfree(overlay);
1475− return;
14761427 }
14771428
14781429 void intel_cleanup_overlay(struct drm_i915_private *dev_priv)
14791430 {
1480− if (!dev_priv->overlay)
1431+ struct intel_overlay *overlay;
1432+
1433+ overlay = fetch_and_zero(&dev_priv->overlay);
1434+ if (!overlay)
14811435 return;
14821436
1483− /* The bo's should be free'd by the generic code already.
1437+ /*
1438+ * The bo's should be free'd by the generic code already.
14841439 * Furthermore modesetting teardown happens beforehand so the
1485− * hardware should be off already */
1486− WARN_ON(dev_priv->overlay->active);
1440+ * hardware should be off already.
1441+ */
1442+ WARN_ON(overlay->active);
1443+
1444+ i915_gem_object_put(overlay->reg_bo);
14871445
1488− i915_gem_object_put(dev_priv->overlay->reg_bo);
1489− kfree(dev_priv->overlay);
1446+ kfree(overlay);
14901447 }
14911448
14921449 #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
@@ -1498,37 +1455,11 @@ struct intel_overlay_error_state { · 5 unmodified lines
14981455 u32 isr;
14991456 };
15001457
1501−static struct overlay_registers __iomem *
1502−intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
1503−{
1504− struct drm_i915_private *dev_priv = overlay->i915;
1505− struct overlay_registers __iomem *regs;
1506−
1507− if (OVERLAY_NEEDS_PHYSICAL(dev_priv))
1508− /* Cast to make sparse happy, but it's wc memory anyway, so
1509− * equivalent to the wc io mapping on X86. */
1510− regs = (struct overlay_registers __iomem *)
1511− overlay->reg_bo->phys_handle->vaddr;
1512− else
1513− regs = io_mapping_map_atomic_wc(&dev_priv->ggtt.iomap,
1514− overlay->flip_addr);
1515−
1516− return regs;
1517−}
1518−
1519−static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay,
1520− struct overlay_registers __iomem *regs)
1521−{
1522− if (!OVERLAY_NEEDS_PHYSICAL(overlay->i915))
1523− io_mapping_unmap_atomic(regs);
1524−}
1525−
15261458 struct intel_overlay_error_state *
15271459 intel_overlay_capture_error_state(struct drm_i915_private *dev_priv)
15281460 {
15291461 struct intel_overlay *overlay = dev_priv->overlay;
15301462 struct intel_overlay_error_state *error;
1531− struct overlay_registers __iomem *regs;
15321463
15331464 if (!overlay || !overlay->active)
15341465 return NULL;
@@ -1541,18 +1472,9 @@ intel_overlay_capture_error_state(struct drm_i915_private *dev_priv) · 6 unmodified lines
15411472 error->isr = I915_READ(ISR);
15421473 error->base = overlay->flip_addr;
15431474
1544− regs = intel_overlay_map_regs_atomic(overlay);
1545− if (!regs)
1546− goto err;
1547−
1548− memcpy_fromio(&error->regs, regs, sizeof(struct overlay_registers));
1549− intel_overlay_unmap_regs_atomic(overlay, regs);
1475+ memcpy_fromio(&error->regs, overlay->regs, sizeof(error->regs));
15501476
15511477 return error;
1552−
1553−err:
1554− kfree(error);
1555− return NULL;
15561478 }
15571479
15581480 void
drivers/gpu/drm/nouveau/dispnv50/disp.c+49−18
@@ -1123,17 +1123,21 @@ nv50_mstm_enable(struct nv50_mstm *mstm, u8 dpcd, int state) · 1122 unmodified lines
11231123 int ret;
11241124
11251125 if (dpcd >= 0x12) {
1126− ret = drm_dp_dpcd_readb(mstm->mgr.aux, DP_MSTM_CTRL, &dpcd);
1126+ /* Even if we're enabling MST, start with disabling the
1127+ * branching unit to clear any sink-side MST topology state
1128+ * that wasn't set by us
1129+ */
1130+ ret = drm_dp_dpcd_writeb(mstm->mgr.aux, DP_MSTM_CTRL, 0);
11271131 if (ret < 0)
11281132 return ret;
11291133
1130− dpcd &= ~DP_MST_EN;
1131− if (state)
1132− dpcd |= DP_MST_EN;
1133−
1134− ret = drm_dp_dpcd_writeb(mstm->mgr.aux, DP_MSTM_CTRL, dpcd);
1135− if (ret < 0)
1136− return ret;
1134+ if (state) {
1135+ /* Now, start initializing */
1136+ ret = drm_dp_dpcd_writeb(mstm->mgr.aux, DP_MSTM_CTRL,
1137+ DP_MST_EN);
1138+ if (ret < 0)
1139+ return ret;
1140+ }
11371141 }
11381142
11391143 return nvif_mthd(disp, 0, &args, sizeof(args));
@@ -1142,31 +1146,58 @@ nv50_mstm_enable(struct nv50_mstm *mstm, u8 dpcd, int state) · 2 unmodified lines
11421146 int
11431147 nv50_mstm_detect(struct nv50_mstm *mstm, u8 dpcd[8], int allow)
11441148 {
1145− int ret, state = 0;
1149+ struct drm_dp_aux *aux;
1150+ int ret;
1151+ bool old_state, new_state;
1152+ u8 mstm_ctrl;
11461153
11471154 if (!mstm)
11481155 return 0;
11491156
1150− if (dpcd[0] >= 0x12) {
1151− ret = drm_dp_dpcd_readb(mstm->mgr.aux, DP_MSTM_CAP, &dpcd[1]);
1157+ mutex_lock(&mstm->mgr.lock);
1158+
1159+ old_state = mstm->mgr.mst_state;
1160+ new_state = old_state;
1161+ aux = mstm->mgr.aux;
1162+
1163+ if (old_state) {
1164+ /* Just check that the MST hub is still as we expect it */
1165+ ret = drm_dp_dpcd_readb(aux, DP_MSTM_CTRL, &mstm_ctrl);
1166+ if (ret < 0 || !(mstm_ctrl & DP_MST_EN)) {
1167+ DRM_DEBUG_KMS("Hub gone, disabling MST topology\n");
1168+ new_state = false;
1169+ }
1170+ } else if (dpcd[0] >= 0x12) {
1171+ ret = drm_dp_dpcd_readb(aux, DP_MSTM_CAP, &dpcd[1]);
11521172 if (ret < 0)
1153− return ret;
1173+ goto probe_error;
11541174
11551175 if (!(dpcd[1] & DP_MST_CAP))
11561176 dpcd[0] = 0x11;
11571177 else
1158− state = allow;
1178+ new_state = allow;
1179+ }
1180+
1181+ if (new_state == old_state) {
1182+ mutex_unlock(&mstm->mgr.lock);
1183+ return new_state;
11591184 }
11601185
1161− ret = nv50_mstm_enable(mstm, dpcd[0], state);
1186+ ret = nv50_mstm_enable(mstm, dpcd[0], new_state);
11621187 if (ret)
1163− return ret;
1188+ goto probe_error;
1189+
1190+ mutex_unlock(&mstm->mgr.lock);
11641191
1165− ret = drm_dp_mst_topology_mgr_set_mst(&mstm->mgr, state);
1192+ ret = drm_dp_mst_topology_mgr_set_mst(&mstm->mgr, new_state);
11661193 if (ret)
11671194 return nv50_mstm_enable(mstm, dpcd[0], 0);
11681195
1169− return mstm->mgr.mst_state;
1196+ return new_state;
1197+
1198+probe_error:
1199+ mutex_unlock(&mstm->mgr.lock);
1200+ return ret;
11701201 }
11711202
11721203 static void
@@ -2074,7 +2105,7 @@ nv50_disp_atomic_state_alloc(struct drm_device *dev) · 901 unmodified lines
20742105 static const struct drm_mode_config_funcs
20752106 nv50_disp_func = {
20762107 .fb_create = nouveau_user_framebuffer_create,
2077− .output_poll_changed = drm_fb_helper_output_poll_changed,
2108+ .output_poll_changed = nouveau_fbcon_output_poll_changed,
20782109 .atomic_check = nv50_disp_atomic_check,
20792110 .atomic_commit = nv50_disp_atomic_commit,
20802111 .atomic_state_alloc = nv50_disp_atomic_state_alloc,
drivers/gpu/drm/nouveau/nouveau_connector.c+60−50
@@ -409,59 +409,45 @@ static struct nouveau_encoder * · 408 unmodified lines
409409 nouveau_connector_ddc_detect(struct drm_connector *connector)
410410 {
411411 struct drm_device *dev = connector->dev;
412− struct nouveau_connector *nv_connector = nouveau_connector(connector);
413− struct nouveau_drm *drm = nouveau_drm(dev);
414− struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
415− struct nouveau_encoder *nv_encoder = NULL;
412+ struct nouveau_encoder *nv_encoder = NULL, *found = NULL;
416413 struct drm_encoder *encoder;
417− int i, panel = -ENODEV;
418−
419− /* eDP panels need powering on by us (if the VBIOS doesn't default it
420− * to on) before doing any AUX channel transactions. LVDS panel power
421− * is handled by the SOR itself, and not required for LVDS DDC.
422− */
423− if (nv_connector->type == DCB_CONNECTOR_eDP) {
424− panel = nvkm_gpio_get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff);
425− if (panel == 0) {
426− nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
427− msleep(300);
428− }
429− }
414+ int i, ret;
415+ bool switcheroo_ddc = false;
430416
431417 drm_connector_for_each_possible_encoder(connector, encoder, i) {
432418 nv_encoder = nouveau_encoder(encoder);
433419
434− if (nv_encoder->dcb->type == DCB_OUTPUT_DP) {
435− int ret = nouveau_dp_detect(nv_encoder);
420+ switch (nv_encoder->dcb->type) {
421+ case DCB_OUTPUT_DP:
422+ ret = nouveau_dp_detect(nv_encoder);
436423 if (ret == NOUVEAU_DP_MST)
437424 return NULL;
438− if (ret == NOUVEAU_DP_SST)
439− break;
440− } else
441− if ((vga_switcheroo_handler_flags() &
442− VGA_SWITCHEROO_CAN_SWITCH_DDC) &&
443− nv_encoder->dcb->type == DCB_OUTPUT_LVDS &&
444− nv_encoder->i2c) {
445− int ret;
446− vga_switcheroo_lock_ddc(dev->pdev);
447− ret = nvkm_probe_i2c(nv_encoder->i2c, 0x50);
448− vga_switcheroo_unlock_ddc(dev->pdev);
449− if (ret)
425+ else if (ret == NOUVEAU_DP_SST)
426+ found = nv_encoder;
427+
428+ break;
429+ case DCB_OUTPUT_LVDS:
430+ switcheroo_ddc = !!(vga_switcheroo_handler_flags() &
431+ VGA_SWITCHEROO_CAN_SWITCH_DDC);
432+ /* fall-through */
433+ default:
434+ if (!nv_encoder->i2c)
450435 break;
451− } else
452− if (nv_encoder->i2c) {
436+
437+ if (switcheroo_ddc)
438+ vga_switcheroo_lock_ddc(dev->pdev);
453439 if (nvkm_probe_i2c(nv_encoder->i2c, 0x50))
454− break;
440+ found = nv_encoder;
441+ if (switcheroo_ddc)
442+ vga_switcheroo_unlock_ddc(dev->pdev);
443+
444+ break;
455445 }
446+ if (found)
447+ break;
456448 }
457449
458− /* eDP panel not detected, restore panel power GPIO to previous
459− * state to avoid confusing the SOR for other output types.
460− */
461− if (!nv_encoder && panel == 0)
462− nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, panel);
463−
464− return nv_encoder;
450+ return found;
465451 }
466452
467453 static struct nouveau_encoder *
@@ -555,12 +541,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) · 87 unmodified lines
555541 nv_connector->edid = NULL;
556542 }
557543
558− /* Outputs are only polled while runtime active, so acquiring a
559− * runtime PM ref here is unnecessary (and would deadlock upon
560− * runtime suspend because it waits for polling to finish).
544+ /* Outputs are only polled while runtime active, so resuming the
545+ * device here is unnecessary (and would deadlock upon runtime suspend
546+ * because it waits for polling to finish). We do however, want to
547+ * prevent the autosuspend timer from elapsing during this operation
548+ * if possible.
561549 */
562− if (!drm_kms_helper_is_poll_worker()) {
563− ret = pm_runtime_get_sync(connector->dev->dev);
550+ if (drm_kms_helper_is_poll_worker()) {
551+ pm_runtime_get_noresume(dev->dev);
552+ } else {
553+ ret = pm_runtime_get_sync(dev->dev);
564554 if (ret < 0 && ret != -EACCES)
565555 return conn_status;
566556 }
@@ -638,10 +628,8 @@ detect_analog: · 71 unmodified lines
638628
639629 out:
640630
641− if (!drm_kms_helper_is_poll_worker()) {
642− pm_runtime_mark_last_busy(connector->dev->dev);
643− pm_runtime_put_autosuspend(connector->dev->dev);
644− }
631+ pm_runtime_mark_last_busy(dev->dev);
632+ pm_runtime_put_autosuspend(dev->dev);
645633
646634 return conn_status;
647635 }
@@ -1105,6 +1093,26 @@ nouveau_connector_hotplug(struct nvif_notify *notify) · 457 unmodified lines
11051093 const struct nvif_notify_conn_rep_v0 *rep = notify->data;
11061094 const char *name = connector->name;
11071095 struct nouveau_encoder *nv_encoder;
1096+ int ret;
1097+
1098+ ret = pm_runtime_get(drm->dev->dev);
1099+ if (ret == 0) {
1100+ /* We can't block here if there's a pending PM request
1101+ * running, as we'll deadlock nouveau_display_fini() when it
1102+ * calls nvif_put() on our nvif_notify struct. So, simply
1103+ * defer the hotplug event until the device finishes resuming
1104+ */
1105+ NV_DEBUG(drm, "Deferring HPD on %s until runtime resume\n",
1106+ name);
1107+ schedule_work(&drm->hpd_work);
1108+
1109+ pm_runtime_put_noidle(drm->dev->dev);
1110+ return NVIF_NOTIFY_KEEP;
1111+ } else if (ret != 1 && ret != -EACCES) {
1112+ NV_WARN(drm, "HPD on %s dropped due to RPM failure: %d\n",
1113+ name, ret);
1114+ return NVIF_NOTIFY_DROP;
1115+ }
11081116
11091117 if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) {
11101118 NV_DEBUG(drm, "service %s\n", name);
@@ -1122,6 +1130,8 @@ nouveau_connector_hotplug(struct nvif_notify *notify) · 11 unmodified lines
11221130 drm_helper_hpd_irq_event(connector->dev);
11231131 }
11241132
1133+ pm_runtime_mark_last_busy(drm->dev->dev);
1134+ pm_runtime_put_autosuspend(drm->dev->dev);
11251135 return NVIF_NOTIFY_KEEP;
11261136 }
11271137
drivers/gpu/drm/nouveau/nouveau_display.c+32−12
@@ -293,7 +293,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev, · 292 unmodified lines
293293
294294 static const struct drm_mode_config_funcs nouveau_mode_config_funcs = {
295295 .fb_create = nouveau_user_framebuffer_create,
296− .output_poll_changed = drm_fb_helper_output_poll_changed,
296+ .output_poll_changed = nouveau_fbcon_output_poll_changed,
297297 };
298298
299299
@@ -355,8 +355,6 @@ nouveau_display_hpd_work(struct work_struct *work) · 55 unmodified lines
355355 pm_runtime_get_sync(drm->dev->dev);
356356
357357 drm_helper_hpd_irq_event(drm->dev);
358− /* enable polling for external displays */
359− drm_kms_helper_poll_enable(drm->dev);
360358
361359 pm_runtime_mark_last_busy(drm->dev->dev);
362360 pm_runtime_put_sync(drm->dev->dev);
@@ -379,15 +377,29 @@ nouveau_display_acpi_ntfy(struct notifier_block *nb, unsigned long val, · 16 unmodified lines
379377 {
380378 struct nouveau_drm *drm = container_of(nb, typeof(*drm), acpi_nb);
381379 struct acpi_bus_event *info = data;
380+ int ret;
382381
383382 if (!strcmp(info->device_class, ACPI_VIDEO_CLASS)) {
384383 if (info->type == ACPI_VIDEO_NOTIFY_PROBE) {
385− /*
386− * This may be the only indication we receive of a
387− * connector hotplug on a runtime suspended GPU,
388− * schedule hpd_work to check.
389− */
390− schedule_work(&drm->hpd_work);
384+ ret = pm_runtime_get(drm->dev->dev);
385+ if (ret == 1 || ret == -EACCES) {
386+ /* If the GPU is already awake, or in a state
387+ * where we can't wake it up, it can handle
388+ * it's own hotplug events.
389+ */
390+ pm_runtime_put_autosuspend(drm->dev->dev);
391+ } else if (ret == 0) {
392+ /* This may be the only indication we receive
393+ * of a connector hotplug on a runtime
394+ * suspended GPU, schedule hpd_work to check.
395+ */
396+ NV_DEBUG(drm, "ACPI requested connector reprobe\n");
397+ schedule_work(&drm->hpd_work);
398+ pm_runtime_put_noidle(drm->dev->dev);
399+ } else {
400+ NV_WARN(drm, "Dropped ACPI reprobe event due to RPM error: %d\n",
401+ ret);
402+ }
391403
392404 /* acpi-video should not generate keypresses for this */
393405 return NOTIFY_BAD;
@@ -411,6 +423,11 @@ nouveau_display_init(struct drm_device *dev) · 17 unmodified lines
411423 if (ret)
412424 return ret;
413425
426+ /* enable connector detection and polling for connectors without HPD
427+ * support
428+ */
429+ drm_kms_helper_poll_enable(dev);
430+
414431 /* enable hotplug interrupts */
415432 drm_connector_list_iter_begin(dev, &conn_iter);
416433 nouveau_for_each_non_mst_connector_iter(connector, &conn_iter) {
@@ -425,7 +442,7 @@ nouveau_display_init(struct drm_device *dev) · 8 unmodified lines
425442 }
426443
427444 void
428−nouveau_display_fini(struct drm_device *dev, bool suspend)
445+nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
429446 {
430447 struct nouveau_display *disp = nouveau_display(dev);
431448 struct nouveau_drm *drm = nouveau_drm(dev);
@@ -450,6 +467,9 @@ nouveau_display_fini(struct drm_device *dev, bool suspend) · 18 unmodified lines
450467 }
451468 drm_connector_list_iter_end(&conn_iter);
452469
470+ if (!runtime)
471+ cancel_work_sync(&drm->hpd_work);
472+
453473 drm_kms_helper_poll_disable(dev);
454474 disp->fini(dev);
455475 }
@@ -618,11 +638,11 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime) · 162 unmodified lines
618638 }
619639 }
620640
621− nouveau_display_fini(dev, true);
641+ nouveau_display_fini(dev, true, runtime);
622642 return 0;
623643 }
624644
625− nouveau_display_fini(dev, true);
645+ nouveau_display_fini(dev, true, runtime);
626646
627647 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
628648 struct nouveau_framebuffer *nouveau_fb;
drivers/gpu/drm/nouveau/nouveau_display.h+1−1
@@ -62,7 +62,7 @@ nouveau_display(struct drm_device *dev) · 61 unmodified lines
6262 int nouveau_display_create(struct drm_device *dev);
6363 void nouveau_display_destroy(struct drm_device *dev);
6464 int nouveau_display_init(struct drm_device *dev);
65−void nouveau_display_fini(struct drm_device *dev, bool suspend);
65+void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
6666 int nouveau_display_suspend(struct drm_device *dev, bool runtime);
6767 void nouveau_display_resume(struct drm_device *dev, bool runtime);
6868 int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
drivers/gpu/drm/nouveau/nouveau_drm.c+9−12
@@ -230,7 +230,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, · 229 unmodified lines
230230 mutex_unlock(&drm->master.lock);
231231 }
232232 if (ret) {
233− NV_ERROR(drm, "Client allocation failed: %d\n", ret);
233+ NV_PRINTK(err, cli, "Client allocation failed: %d\n", ret);
234234 goto done;
235235 }
236236
@@ -240,37 +240,37 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname, · 3 unmodified lines
240240 }, sizeof(struct nv_device_v0),
241241 &cli->device);
242242 if (ret) {
243− NV_ERROR(drm, "Device allocation failed: %d\n", ret);
243+ NV_PRINTK(err, cli, "Device allocation failed: %d\n", ret);
244244 goto done;
245245 }
246246
247247 ret = nvif_mclass(&cli->device.object, mmus);
248248 if (ret < 0) {
249− NV_ERROR(drm, "No supported MMU class\n");
249+ NV_PRINTK(err, cli, "No supported MMU class\n");
250250 goto done;
251251 }
252252
253253 ret = nvif_mmu_init(&cli->device.object, mmus[ret].oclass, &cli->mmu);
254254 if (ret) {
255− NV_ERROR(drm, "MMU allocation failed: %d\n", ret);
255+ NV_PRINTK(err, cli, "MMU allocation failed: %d\n", ret);
256256 goto done;
257257 }
258258
259259 ret = nvif_mclass(&cli->mmu.object, vmms);
260260 if (ret < 0) {
261− NV_ERROR(drm, "No supported VMM class\n");
261+ NV_PRINTK(err, cli, "No supported VMM class\n");
262262 goto done;
263263 }
264264
265265 ret = nouveau_vmm_init(cli, vmms[ret].oclass, &cli->vmm);
266266 if (ret) {
267− NV_ERROR(drm, "VMM allocation failed: %d\n", ret);
267+ NV_PRINTK(err, cli, "VMM allocation failed: %d\n", ret);
268268 goto done;
269269 }
270270
271271 ret = nvif_mclass(&cli->mmu.object, mems);
272272 if (ret < 0) {
273− NV_ERROR(drm, "No supported MEM class\n");
273+ NV_PRINTK(err, cli, "No supported MEM class\n");
274274 goto done;
275275 }
276276
@@ -592,10 +592,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) · 315 unmodified lines
592592 pm_runtime_allow(dev->dev);
593593 pm_runtime_mark_last_busy(dev->dev);
594594 pm_runtime_put(dev->dev);
595− } else {
596− /* enable polling for external displays */
597− drm_kms_helper_poll_enable(dev);
598595 }
596+
599597 return 0;
600598
601599 fail_dispinit:
@@ -629,7 +627,7 @@ nouveau_drm_unload(struct drm_device *dev) · 27 unmodified lines
629627 nouveau_debugfs_fini(drm);
630628
631629 if (dev->mode_config.num_crtc)
632− nouveau_display_fini(dev, false);
630+ nouveau_display_fini(dev, false, false);
633631 nouveau_display_destroy(dev);
634632
635633 nouveau_bios_takedown(dev);
@@ -835,7 +833,6 @@ nouveau_pmops_runtime_suspend(struct device *dev) · 199 unmodified lines
835833 return -EBUSY;
836834 }
837835
838− drm_kms_helper_poll_disable(drm_dev);
839836 nouveau_switcheroo_optimus_dsm();
840837 ret = nouveau_do_suspend(drm_dev, true);
841838 pci_save_state(pdev);
drivers/gpu/drm/nouveau/nouveau_fbcon.c+57−0
@@ -466,6 +466,7 @@ nouveau_fbcon_set_suspend_work(struct work_struct *work) · 465 unmodified lines
466466 console_unlock();
467467
468468 if (state == FBINFO_STATE_RUNNING) {
469+ nouveau_fbcon_hotplug_resume(drm->fbcon);
469470 pm_runtime_mark_last_busy(drm->dev->dev);
470471 pm_runtime_put_sync(drm->dev->dev);
471472 }
@@ -487,6 +488,61 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) · 15 unmodified lines
487488 schedule_work(&drm->fbcon_work);
488489 }
489490
491+void
492+nouveau_fbcon_output_poll_changed(struct drm_device *dev)
493+{
494+ struct nouveau_drm *drm = nouveau_drm(dev);
495+ struct nouveau_fbdev *fbcon = drm->fbcon;
496+ int ret;
497+
498+ if (!fbcon)
499+ return;
500+
501+ mutex_lock(&fbcon->hotplug_lock);
502+
503+ ret = pm_runtime_get(dev->dev);
504+ if (ret == 1 || ret == -EACCES) {
505+ drm_fb_helper_hotplug_event(&fbcon->helper);
506+
507+ pm_runtime_mark_last_busy(dev->dev);
508+ pm_runtime_put_autosuspend(dev->dev);
509+ } else if (ret == 0) {
510+ /* If the GPU was already in the process of suspending before
511+ * this event happened, then we can't block here as we'll
512+ * deadlock the runtime pmops since they wait for us to
513+ * finish. So, just defer this event for when we runtime
514+ * resume again. It will be handled by fbcon_work.
515+ */
516+ NV_DEBUG(drm, "fbcon HPD event deferred until runtime resume\n");
517+ fbcon->hotplug_waiting = true;
518+ pm_runtime_put_noidle(drm->dev->dev);
519+ } else {
520+ DRM_WARN("fbcon HPD event lost due to RPM failure: %d\n",
521+ ret);
522+ }
523+
524+ mutex_unlock(&fbcon->hotplug_lock);
525+}
526+
527+void
528+nouveau_fbcon_hotplug_resume(struct nouveau_fbdev *fbcon)
529+{
530+ struct nouveau_drm *drm;
531+
532+ if (!fbcon)
533+ return;
534+ drm = nouveau_drm(fbcon->helper.dev);
535+
536+ mutex_lock(&fbcon->hotplug_lock);
537+ if (fbcon->hotplug_waiting) {
538+ fbcon->hotplug_waiting = false;
539+
540+ NV_DEBUG(drm, "Handling deferred fbcon HPD events\n");
541+ drm_fb_helper_hotplug_event(&fbcon->helper);
542+ }
543+ mutex_unlock(&fbcon->hotplug_lock);
544+}
545+
490546 int
491547 nouveau_fbcon_init(struct drm_device *dev)
492548 {
@@ -505,6 +561,7 @@ nouveau_fbcon_init(struct drm_device *dev) · 12 unmodified lines
505561
506562 drm->fbcon = fbcon;
507563 INIT_WORK(&drm->fbcon_work, nouveau_fbcon_set_suspend_work);
564+ mutex_init(&fbcon->hotplug_lock);
508565
509566 drm_fb_helper_prepare(dev, &fbcon->helper, &nouveau_fbcon_helper_funcs);
510567
drivers/gpu/drm/nouveau/nouveau_fbcon.h+5−0
@@ -41,6 +41,9 @@ struct nouveau_fbdev { · 40 unmodified lines
4141 struct nvif_object gdi;
4242 struct nvif_object blit;
4343 struct nvif_object twod;
44+
45+ struct mutex hotplug_lock;
46+ bool hotplug_waiting;
4447 };
4548
4649 void nouveau_fbcon_restore(void);
@@ -68,6 +71,8 @@ void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); · 21 unmodified lines
6871 void nouveau_fbcon_accel_save_disable(struct drm_device *dev);
6972 void nouveau_fbcon_accel_restore(struct drm_device *dev);
7073
74+void nouveau_fbcon_output_poll_changed(struct drm_device *dev);
75+void nouveau_fbcon_hotplug_resume(struct nouveau_fbdev *fbcon);
7176 extern int nouveau_nofbaccel;
7277
7378 #endif /* __NV50_FBCON_H__ */
drivers/gpu/drm/nouveau/nouveau_vga.c+0−2
@@ -46,12 +46,10 @@ nouveau_switcheroo_set_state(struct pci_dev *pdev, · 45 unmodified lines
4646 pr_err("VGA switcheroo: switched nouveau on\n");
4747 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
4848 nouveau_pmops_resume(&pdev->dev);
49− drm_kms_helper_poll_enable(dev);
5049 dev->switch_power_state = DRM_SWITCH_POWER_ON;
5150 } else {
5251 pr_err("VGA switcheroo: switched nouveau off\n");
5352 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
54− drm_kms_helper_poll_disable(dev);
5553 nouveau_switcheroo_optimus_dsm();
5654 nouveau_pmops_suspend(&pdev->dev);
5755 dev->switch_power_state = DRM_SWITCH_POWER_OFF;
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c+14−0
@@ -275,6 +275,7 @@ nvkm_disp_oneinit(struct nvkm_engine *engine) · 274 unmodified lines
275275 struct nvkm_outp *outp, *outt, *pair;
276276 struct nvkm_conn *conn;
277277 struct nvkm_head *head;
278+ struct nvkm_ior *ior;
278279 struct nvbios_connE connE;
279280 struct dcb_output dcbE;
280281 u8 hpd = 0, ver, hdr;
@@ -399,6 +400,19 @@ nvkm_disp_oneinit(struct nvkm_engine *engine) · 118 unmodified lines
399400 return ret;
400401 }
401402
403+ /* Enforce identity-mapped SOR assignment for panels, which have
404+ * certain bits (ie. backlight controls) wired to a specific SOR.
405+ */
406+ list_for_each_entry(outp, &disp->outp, head) {
407+ if (outp->conn->info.type == DCB_CONNECTOR_LVDS ||
408+ outp->conn->info.type == DCB_CONNECTOR_eDP) {
409+ ior = nvkm_ior_find(disp, SOR, ffs(outp->info.or) - 1);
410+ if (!WARN_ON(!ior))
411+ ior->identity = true;
412+ outp->identity = true;
413+ }
414+ }
415+
402416 i = 0;
403417 list_for_each_entry(head, &disp->head, head)
404418 i = max(i, head->id + 1);
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c+46−8
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828
2929 #include <subdev/bios.h>
3030 #include <subdev/bios/init.h>
31+#include <subdev/gpio.h>
3132 #include <subdev/i2c.h>
3233
3334 #include <nvif/event.h>
@@ -412,14 +413,10 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps) · 378 unmodified lines
412413 }
413414
414415 static void
415−nvkm_dp_release(struct nvkm_outp *outp, struct nvkm_ior *ior)
416+nvkm_dp_disable(struct nvkm_outp *outp, struct nvkm_ior *ior)
416417 {
417418 struct nvkm_dp *dp = nvkm_dp(outp);
418419
419− /* Prevent link from being retrained if sink sends an IRQ. */
420− atomic_set(&dp->lt.done, 0);
421− ior->dp.nr = 0;
422−
423420 /* Execute DisableLT script from DP Info Table. */
424421 nvbios_init(&ior->disp->engine.subdev, dp->info.script[4],
425422 init.outp = &dp->outp.info;
@@ -428,6 +425,16 @@ nvkm_dp_release(struct nvkm_outp *outp, struct nvkm_ior *ior) · 2 unmodified lines
428425 );
429426 }
430427
428+static void
429+nvkm_dp_release(struct nvkm_outp *outp)
430+{
431+ struct nvkm_dp *dp = nvkm_dp(outp);
432+
433+ /* Prevent link from being retrained if sink sends an IRQ. */
434+ atomic_set(&dp->lt.done, 0);
435+ dp->outp.ior->dp.nr = 0;
436+}
437+
431438 static int
432439 nvkm_dp_acquire(struct nvkm_outp *outp)
433440 {
@@ -491,7 +498,7 @@ done: · 57 unmodified lines
491498 return ret;
492499 }
493500
494−static void
501+static bool
495502 nvkm_dp_enable(struct nvkm_dp *dp, bool enable)
496503 {
497504 struct nvkm_i2c_aux *aux = dp->aux;
@@ -505,7 +512,7 @@ nvkm_dp_enable(struct nvkm_dp *dp, bool enable) · 7 unmodified lines
505512
506513 if (!nvkm_rdaux(aux, DPCD_RC00_DPCD_REV, dp->dpcd,
507514 sizeof(dp->dpcd)))
508− return;
515+ return true;
509516 }
510517
511518 if (dp->present) {
@@ -515,6 +522,7 @@ nvkm_dp_enable(struct nvkm_dp *dp, bool enable) · 3 unmodified lines
515522 }
516523
517524 atomic_set(&dp->lt.done, 0);
525+ return false;
518526 }
519527
520528 static int
@@ -555,9 +563,38 @@ nvkm_dp_fini(struct nvkm_outp *outp) · 34 unmodified lines
555563 static void
556564 nvkm_dp_init(struct nvkm_outp *outp)
557565 {
566+ struct nvkm_gpio *gpio = outp->disp->engine.subdev.device->gpio;
558567 struct nvkm_dp *dp = nvkm_dp(outp);
568+
559569 nvkm_notify_put(&dp->outp.conn->hpd);
560− nvkm_dp_enable(dp, true);
570+
571+ /* eDP panels need powering on by us (if the VBIOS doesn't default it
572+ * to on) before doing any AUX channel transactions. LVDS panel power
573+ * is handled by the SOR itself, and not required for LVDS DDC.
574+ */
575+ if (dp->outp.conn->info.type == DCB_CONNECTOR_eDP) {
576+ int power = nvkm_gpio_get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff);
577+ if (power == 0)
578+ nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
579+
580+ /* We delay here unconditionally, even if already powered,
581+ * because some laptop panels having a significant resume
582+ * delay before the panel begins responding.
583+ *
584+ * This is likely a bit of a hack, but no better idea for
585+ * handling this at the moment.
586+ */
587+ msleep(300);
588+
589+ /* If the eDP panel can't be detected, we need to restore
590+ * the panel power GPIO to avoid breaking another output.
591+ */
592+ if (!nvkm_dp_enable(dp, true) && power == 0)
593+ nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 0);
594+ } else {
595+ nvkm_dp_enable(dp, true);
596+ }
597+
561598 nvkm_notify_get(&dp->hpd);
562599 }
563600
@@ -576,6 +613,7 @@ nvkm_dp_func = { · 12 unmodified lines
576613 .fini = nvkm_dp_fini,
577614 .acquire = nvkm_dp_acquire,
578615 .release = nvkm_dp_release,
616+ .disable = nvkm_dp_disable,
579617 };
580618
581619 static int
drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h+1−0
@@ -16,6 +16,7 @@ struct nvkm_ior { · 15 unmodified lines
1616 char name[8];
1717
1818 struct list_head head;
19+ bool identity;
1920
2021 struct nvkm_ior_state {
2122 struct nvkm_outp *outp;
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c+3−3
@@ -501,11 +501,11 @@ nv50_disp_super_2_0(struct nv50_disp *disp, struct nvkm_head *head) · 500 unmodified lines
501501 nv50_disp_super_ied_off(head, ior, 2);
502502
503503 /* If we're shutting down the OR's only active head, execute
504− * the output path's release function.
504+ * the output path's disable function.
505505 */
506506 if (ior->arm.head == (1 << head->id)) {
507− if ((outp = ior->arm.outp) && outp->func->release)
508− outp->func->release(outp, ior);
507+ if ((outp = ior->arm.outp) && outp->func->disable)
508+ outp->func->disable(outp, ior);
509509 }
510510 }
511511
drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c+14−4
@@ -93,6 +93,8 @@ nvkm_outp_release(struct nvkm_outp *outp, u8 user) · 92 unmodified lines
9393 if (ior) {
9494 outp->acquired &= ~user;
9595 if (!outp->acquired) {
96+ if (outp->func->release && outp->ior)
97+ outp->func->release(outp);
9698 outp->ior->asy.outp = NULL;
9799 outp->ior = NULL;
98100 }
@@ -127,17 +129,26 @@ nvkm_outp_acquire(struct nvkm_outp *outp, u8 user) · 28 unmodified lines
127129 if (proto == UNKNOWN)
128130 return -ENOSYS;
129131
132+ /* Deal with panels requiring identity-mapped SOR assignment. */
133+ if (outp->identity) {
134+ ior = nvkm_ior_find(outp->disp, SOR, ffs(outp->info.or) - 1);
135+ if (WARN_ON(!ior))
136+ return -ENOSPC;
137+ return nvkm_outp_acquire_ior(outp, user, ior);
138+ }
139+
130140 /* First preference is to reuse the OR that is currently armed
131141 * on HW, if any, in order to prevent unnecessary switching.
132142 */
133143 list_for_each_entry(ior, &outp->disp->ior, head) {
134− if (!ior->asy.outp && ior->arm.outp == outp)
144+ if (!ior->identity && !ior->asy.outp && ior->arm.outp == outp)
135145 return nvkm_outp_acquire_ior(outp, user, ior);
136146 }
137147
138148 /* Failing that, a completely unused OR is the next best thing. */
139149 list_for_each_entry(ior, &outp->disp->ior, head) {
140− if (!ior->asy.outp && ior->type == type && !ior->arm.outp &&
150+ if (!ior->identity &&
151+ !ior->asy.outp && ior->type == type && !ior->arm.outp &&
141152 (ior->func->route.set || ior->id == __ffs(outp->info.or)))
142153 return nvkm_outp_acquire_ior(outp, user, ior);
143154 }
@@ -146,7 +157,7 @@ nvkm_outp_acquire(struct nvkm_outp *outp, u8 user) · 2 unmodified lines
146157 * but will be released during the next modeset.
147158 */
148159 list_for_each_entry(ior, &outp->disp->ior, head) {
149− if (!ior->asy.outp && ior->type == type &&
160+ if (!ior->identity && !ior->asy.outp && ior->type == type &&
150161 (ior->func->route.set || ior->id == __ffs(outp->info.or)))
151162 return nvkm_outp_acquire_ior(outp, user, ior);
152163 }
@@ -245,7 +256,6 @@ nvkm_outp_ctor(const struct nvkm_outp_func *func, struct nvkm_disp *disp, · 92 unmodified lines
245256 outp->index = index;
246257 outp->info = *dcbE;
247258 outp->i2c = nvkm_i2c_bus_find(i2c, dcbE->i2c_index);
248− outp->or = ffs(outp->info.or) - 1;
249259
250260 OUTP_DBG(outp, "type %02x loc %d or %d link %d con %x "
251261 "edid %x bus %d head %x",
drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h+3−2
@@ -13,10 +13,10 @@ struct nvkm_outp { · 12 unmodified lines
1313 struct dcb_output info;
1414
1515 struct nvkm_i2c_bus *i2c;
16− int or;
1716
1817 struct list_head head;
1918 struct nvkm_conn *conn;
19+ bool identity;
2020
2121 /* Assembly state. */
2222 #define NVKM_OUTP_PRIV 1
@@ -41,7 +41,8 @@ struct nvkm_outp_func { · 18 unmodified lines
4141 void (*init)(struct nvkm_outp *);
4242 void (*fini)(struct nvkm_outp *);
4343 int (*acquire)(struct nvkm_outp *);
44− void (*release)(struct nvkm_outp *, struct nvkm_ior *);
44+ void (*release)(struct nvkm_outp *);
45+ void (*disable)(struct nvkm_outp *, struct nvkm_ior *);
4546 };
4647
4748 #define OUTP_MSG(o,l,f,a...) do { \
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm200.c+13−11
@@ -86,10 +86,8 @@ pmu_load(struct nv50_devinit *init, u8 type, bool post, · 85 unmodified lines
8686 struct nvkm_bios *bios = subdev->device->bios;
8787 struct nvbios_pmuR pmu;
8888
89− if (!nvbios_pmuRm(bios, type, &pmu)) {
90− nvkm_error(subdev, "VBIOS PMU fuc %02x not found\n", type);
89+ if (!nvbios_pmuRm(bios, type, &pmu))
9190 return -EINVAL;
92− }
9391
9492 if (!post)
9593 return 0;
@@ -124,29 +122,30 @@ gm200_devinit_post(struct nvkm_devinit *base, bool post) · 28 unmodified lines
124122 return -EINVAL;
125123 }
126124
125+ /* Upload DEVINIT application from VBIOS onto PMU. */
127126 ret = pmu_load(init, 0x04, post, &exec, &args);
128− if (ret)
127+ if (ret) {
128+ nvkm_error(subdev, "VBIOS PMU/DEVINIT not found\n");
129129 return ret;
130+ }
130131
131− /* upload first chunk of init data */
132+ /* Upload tables required by opcodes in boot scripts. */
132133 if (post) {
133− // devinit tables
134134 u32 pmu = pmu_args(init, args + 0x08, 0x08);
135135 u32 img = nvbios_rd16(bios, bit_I.offset + 0x14);
136136 u32 len = nvbios_rd16(bios, bit_I.offset + 0x16);
137137 pmu_data(init, pmu, img, len);
138138 }
139139
140− /* upload second chunk of init data */
140+ /* Upload boot scripts. */
141141 if (post) {
142− // devinit boot scripts
143142 u32 pmu = pmu_args(init, args + 0x08, 0x10);
144143 u32 img = nvbios_rd16(bios, bit_I.offset + 0x18);
145144 u32 len = nvbios_rd16(bios, bit_I.offset + 0x1a);
146145 pmu_data(init, pmu, img, len);
147146 }
148147
149− /* execute init tables */
148+ /* Execute DEVINIT. */
150149 if (post) {
151150 nvkm_wr32(device, 0x10a040, 0x00005000);
152151 pmu_exec(init, exec);
@@ -157,8 +156,11 @@ gm200_devinit_post(struct nvkm_devinit *base, bool post) · 4 unmodified lines
157156 return -ETIMEDOUT;
158157 }
159158
160− /* load and execute some other ucode image (bios therm?) */
161− return pmu_load(init, 0x01, post, NULL, NULL);
159+ /* Optional: Execute PRE_OS application on PMU, which should at
160+ * least take care of fans until a full PMU has been loaded.
161+ */
162+ pmu_load(init, 0x01, post, NULL, NULL);
163+ return 0;
162164 }
163165
164166 static const struct nvkm_devinit_func
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c+1−1
@@ -1423,7 +1423,7 @@ nvkm_vmm_get(struct nvkm_vmm *vmm, u8 page, u64 size, struct nvkm_vma **pvma) · 1422 unmodified lines
14231423 void
14241424 nvkm_vmm_part(struct nvkm_vmm *vmm, struct nvkm_memory *inst)
14251425 {
1426− if (vmm->func->part && inst) {
1426+ if (inst && vmm->func->part) {
14271427 mutex_lock(&vmm->mutex);
14281428 vmm->func->part(vmm, inst);
14291429 mutex_unlock(&vmm->mutex);
drivers/gpu/drm/pl111/pl111_vexpress.c+2−1
@@ -111,7 +111,8 @@ static int vexpress_muxfpga_probe(struct platform_device *pdev) · 110 unmodified lines
111111 }
112112
113113 static const struct of_device_id vexpress_muxfpga_match[] = {
114− { .compatible = "arm,vexpress-muxfpga", }
114+ { .compatible = "arm,vexpress-muxfpga", },
115+ {}
115116 };
116117
117118 static struct platform_driver vexpress_muxfpga_driver = {
drivers/gpu/drm/sun4i/sun4i_drv.c+0−1
@@ -418,7 +418,6 @@ static const struct of_device_id sun4i_drv_of_table[] = { · 417 unmodified lines
418418 { .compatible = "allwinner,sun8i-a33-display-engine" },
419419 { .compatible = "allwinner,sun8i-a83t-display-engine" },
420420 { .compatible = "allwinner,sun8i-h3-display-engine" },
421− { .compatible = "allwinner,sun8i-r40-display-engine" },
422421 { .compatible = "allwinner,sun8i-v3s-display-engine" },
423422 { .compatible = "allwinner,sun9i-a80-display-engine" },
424423 { }
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c+0−1
@@ -398,7 +398,6 @@ static struct regmap_config sun8i_hdmi_phy_regmap_config = { · 397 unmodified lines
398398
399399 static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = {
400400 .has_phy_clk = true,
401− .has_second_pll = true,
402401 .phy_init = &sun8i_hdmi_phy_init_h3,
403402 .phy_disable = &sun8i_hdmi_phy_disable_h3,
404403 .phy_config = &sun8i_hdmi_phy_config_h3,
drivers/gpu/drm/sun4i/sun8i_mixer.c+0−24
@@ -545,22 +545,6 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = { · 544 unmodified lines
545545 .vi_num = 1,
546546 };
547547
548−static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
549− .ccsc = 0,
550− .mod_rate = 297000000,
551− .scaler_mask = 0xf,
552− .ui_num = 3,
553− .vi_num = 1,
554−};
555−
556−static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
557− .ccsc = 1,
558− .mod_rate = 297000000,
559− .scaler_mask = 0x3,
560− .ui_num = 1,
561− .vi_num = 1,
562−};
563−
564548 static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
565549 .vi_num = 2,
566550 .ui_num = 1,
@@ -582,14 +566,6 @@ static const struct of_device_id sun8i_mixer_of_table[] = { · 15 unmodified lines
582566 .compatible = "allwinner,sun8i-h3-de2-mixer-0",
583567 .data = &sun8i_h3_mixer0_cfg,
584568 },
585− {
586− .compatible = "allwinner,sun8i-r40-de2-mixer-0",
587− .data = &sun8i_r40_mixer0_cfg,
588− },
589− {
590− .compatible = "allwinner,sun8i-r40-de2-mixer-1",
591− .data = &sun8i_r40_mixer1_cfg,
592− },
593569 {
594570 .compatible = "allwinner,sun8i-v3s-de2-mixer",
595571 .data = &sun8i_v3s_mixer_cfg,
drivers/gpu/drm/sun4i/sun8i_tcon_top.c+0−1
@@ -253,7 +253,6 @@ static int sun8i_tcon_top_remove(struct platform_device *pdev) · 252 unmodified lines
253253
254254 /* sun4i_drv uses this list to check if a device node is a TCON TOP */
255255 const struct of_device_id sun8i_tcon_top_of_table[] = {
256− { .compatible = "allwinner,sun8i-r40-tcon-top" },
257256 { /* sentinel */ }
258257 };
259258 MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table);
drivers/gpu/drm/udl/udl_fb.c+5−3
@@ -432,9 +432,11 @@ static void udl_fbdev_destroy(struct drm_device *dev, · 431 unmodified lines
432432 {
433433 drm_fb_helper_unregister_fbi(&ufbdev->helper);
434434 drm_fb_helper_fini(&ufbdev->helper);
435− drm_framebuffer_unregister_private(&ufbdev->ufb.base);
436− drm_framebuffer_cleanup(&ufbdev->ufb.base);
437− drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
435+ if (ufbdev->ufb.obj) {
436+ drm_framebuffer_unregister_private(&ufbdev->ufb.base);
437+ drm_framebuffer_cleanup(&ufbdev->ufb.base);
438+ drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
439+ }
438440 }
439441
440442 int udl_fbdev_init(struct drm_device *dev)
drivers/gpu/drm/vc4/vc4_plane.c+12−13
@@ -297,6 +297,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) · 296 unmodified lines
297297 vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
298298 vc4_state->crtc_h);
299299
300+ vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
301+ vc4_state->y_scaling[0] == VC4_SCALING_NONE);
302+
300303 if (num_planes > 1) {
301304 vc4_state->is_yuv = true;
302305
@@ -312,24 +315,17 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) · 9 unmodified lines
312315 vc4_get_scaling_mode(vc4_state->src_h[1],
313316 vc4_state->crtc_h);
314317
315− /* YUV conversion requires that scaling be enabled,
316− * even on a plane that's otherwise 1:1. Choose TPZ
317− * for simplicity.
318+ /* YUV conversion requires that horizontal scaling be enabled,
319+ * even on a plane that's otherwise 1:1. Looks like only PPF
320+ * works in that case, so let's pick that one.
318321 */
319− if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
320− vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
321− if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
322− vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
322+ if (vc4_state->is_unity)
323+ vc4_state->x_scaling[0] = VC4_SCALING_PPF;
323324 } else {
324325 vc4_state->x_scaling[1] = VC4_SCALING_NONE;
325326 vc4_state->y_scaling[1] = VC4_SCALING_NONE;
326327 }
327328
328− vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
329− vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
330− vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
331− vc4_state->y_scaling[1] == VC4_SCALING_NONE);
332−
333329 /* No configuring scaling on the cursor plane, since it gets
334330 non-vblank-synced updates, and scaling requires requires
335331 LBM changes which have to be vblank-synced.
@@ -672,7 +668,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane, · 336 unmodified lines
672668 vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
673669 }
674670
675− if (!vc4_state->is_unity) {
671+ if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
672+ vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
673+ vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
674+ vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
676675 /* LBM Base Address. */
677676 if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
678677 vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c+1−1
@@ -3729,7 +3729,7 @@ int vmw_validate_single_buffer(struct vmw_private *dev_priv, · 3728 unmodified lines
37293729 {
37303730 struct vmw_buffer_object *vbo =
37313731 container_of(bo, struct vmw_buffer_object, base);
3732− struct ttm_operation_ctx ctx = { interruptible, true };
3732+ struct ttm_operation_ctx ctx = { interruptible, false };
37333733 int ret;
37343734
37353735 if (vbo->pin_count > 0)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+30−12
@@ -1512,21 +1512,19 @@ static int vmw_kms_check_display_memory(struct drm_device *dev, · 1511 unmodified lines
15121512 struct drm_rect *rects)
15131513 {
15141514 struct vmw_private *dev_priv = vmw_priv(dev);
1515− struct drm_mode_config *mode_config = &dev->mode_config;
15161515 struct drm_rect bounding_box = {0};
15171516 u64 total_pixels = 0, pixel_mem, bb_mem;
15181517 int i;
15191518
15201519 for (i = 0; i < num_rects; i++) {
15211520 /*
1522− * Currently this check is limiting the topology within max
1523− * texture/screentarget size. This should change in future when
1524− * user-space support multiple fb with topology.
1521+ * For STDU only individual screen (screen target) is limited by
1522+ * SCREENTARGET_MAX_WIDTH/HEIGHT registers.
15251523 */
1526− if (rects[i].x1 < 0 || rects[i].y1 < 0 ||
1527− rects[i].x2 > mode_config->max_width ||
1528− rects[i].y2 > mode_config->max_height) {
1529− DRM_ERROR("Invalid GUI layout.\n");
1524+ if (dev_priv->active_display_unit == vmw_du_screen_target &&
1525+ (drm_rect_width(&rects[i]) > dev_priv->stdu_max_width ||
1526+ drm_rect_height(&rects[i]) > dev_priv->stdu_max_height)) {
1527+ DRM_ERROR("Screen size not supported.\n");
15301528 return -EINVAL;
15311529 }
15321530
@@ -1615,7 +1613,7 @@ static int vmw_kms_check_topology(struct drm_device *dev, · 82 unmodified lines
16151613 struct drm_connector_state *conn_state;
16161614 struct vmw_connector_state *vmw_conn_state;
16171615
1618− if (!new_crtc_state->enable && old_crtc_state->enable) {
1616+ if (!new_crtc_state->enable) {
16191617 rects[i].x1 = 0;
16201618 rects[i].y1 = 0;
16211619 rects[i].x2 = 0;
@@ -2216,12 +2214,16 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, · 594 unmodified lines
22162214 if (dev_priv->assume_16bpp)
22172215 assumed_bpp = 2;
22182216
2217+ max_width = min(max_width, dev_priv->texture_max_width);
2218+ max_height = min(max_height, dev_priv->texture_max_height);
2219+
2220+ /*
2221+ * For STDU extra limit for a mode on SVGA_REG_SCREENTARGET_MAX_WIDTH/
2222+ * HEIGHT registers.
2223+ */
22192224 if (dev_priv->active_display_unit == vmw_du_screen_target) {
22202225 max_width = min(max_width, dev_priv->stdu_max_width);
2221− max_width = min(max_width, dev_priv->texture_max_width);
2222−
22232226 max_height = min(max_height, dev_priv->stdu_max_height);
2224− max_height = min(max_height, dev_priv->texture_max_height);
22252227 }
22262228
22272229 /* Add preferred mode */
@@ -2376,6 +2378,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, · 148 unmodified lines
23762378 struct drm_file *file_priv)
23772379 {
23782380 struct vmw_private *dev_priv = vmw_priv(dev);
2381+ struct drm_mode_config *mode_config = &dev->mode_config;
23792382 struct drm_vmw_update_layout_arg *arg =
23802383 (struct drm_vmw_update_layout_arg *)data;
23812384 void __user *user_rects;
@@ -2421,6 +2424,21 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, · 39 unmodified lines
24212424 drm_rects[i].y1 = curr_rect.y;
24222425 drm_rects[i].x2 = curr_rect.x + curr_rect.w;
24232426 drm_rects[i].y2 = curr_rect.y + curr_rect.h;
2427+
2428+ /*
2429+ * Currently this check is limiting the topology within
2430+ * mode_config->max (which actually is max texture size
2431+ * supported by virtual device). This limit is here to address
2432+ * window managers that create a big framebuffer for whole
2433+ * topology.
2434+ */
2435+ if (drm_rects[i].x1 < 0 || drm_rects[i].y1 < 0 ||
2436+ drm_rects[i].x2 > mode_config->max_width ||
2437+ drm_rects[i].y2 > mode_config->max_height) {
2438+ DRM_ERROR("Invalid GUI layout.\n");
2439+ ret = -EINVAL;
2440+ goto out_free;
2441+ }
24242442 }
24252443
24262444 ret = vmw_kms_check_display_memory(dev, arg->num_outputs, drm_rects);
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c+0−25
@@ -1600,31 +1600,6 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) · 1599 unmodified lines
16001600
16011601 dev_priv->active_display_unit = vmw_du_screen_target;
16021602
1603− if (dev_priv->capabilities & SVGA_CAP_3D) {
1604− /*
1605− * For 3D VMs, display (scanout) buffer size is the smaller of
1606− * max texture and max STDU
1607− */
1608− uint32_t max_width, max_height;
1609−
1610− max_width = min(dev_priv->texture_max_width,
1611− dev_priv->stdu_max_width);
1612− max_height = min(dev_priv->texture_max_height,
1613− dev_priv->stdu_max_height);
1614−
1615− dev->mode_config.max_width = max_width;
1616− dev->mode_config.max_height = max_height;
1617− } else {
1618− /*
1619− * Given various display aspect ratios, there's no way to
1620− * estimate these using prim_bb_mem. So just set these to
1621− * something arbitrarily large and we will reject any layout
1622− * that doesn't fit prim_bb_mem later
1623− */
1624− dev->mode_config.max_width = 8192;
1625− dev->mode_config.max_height = 8192;
1626− }
1627−
16281603 vmw_kms_create_implicit_placement_property(dev_priv, false);
16291604
16301605 for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) {
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+14−10
@@ -1404,22 +1404,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, · 1403 unmodified lines
14041404 *srf_out = NULL;
14051405
14061406 if (for_scanout) {
1407− uint32_t max_width, max_height;
1408−
14091407 if (!svga3dsurface_is_screen_target_format(format)) {
14101408 DRM_ERROR("Invalid Screen Target surface format.");
14111409 return -EINVAL;
14121410 }
14131411
1414− max_width = min(dev_priv->texture_max_width,
1415− dev_priv->stdu_max_width);
1416− max_height = min(dev_priv->texture_max_height,
1417− dev_priv->stdu_max_height);
1418−
1419− if (size.width > max_width || size.height > max_height) {
1412+ if (size.width > dev_priv->texture_max_width ||
1413+ size.height > dev_priv->texture_max_height) {
14201414 DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u",
14211415 size.width, size.height,
1422− max_width, max_height);
1416+ dev_priv->texture_max_width,
1417+ dev_priv->texture_max_height);
14231418 return -EINVAL;
14241419 }
14251420 } else {
@@ -1495,8 +1490,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, · 69 unmodified lines
14951490 if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
14961491 srf->res.backup_size += sizeof(SVGA3dDXSOState);
14971492
1493+ /*
1494+ * Don't set SVGA3D_SURFACE_SCREENTARGET flag for a scanout surface with
1495+ * size greater than STDU max width/height. This is really a workaround
1496+ * to support creation of big framebuffer requested by some user-space
1497+ * for whole topology. That big framebuffer won't really be used for
1498+ * binding with screen target as during prepare_fb a separate surface is
1499+ * created so it's safe to ignore SVGA3D_SURFACE_SCREENTARGET flag.
1500+ */
14981501 if (dev_priv->active_display_unit == vmw_du_screen_target &&
1499− for_scanout)
1502+ for_scanout && size.width <= dev_priv->stdu_max_width &&
1503+ size.height <= dev_priv->stdu_max_height)
15001504 srf->flags |= SVGA3D_SURFACE_SCREENTARGET;
15011505
15021506 /*
drivers/gpu/vga/vga_switcheroo.c+2−0
@@ -215,6 +215,8 @@ static void vga_switcheroo_enable(void) · 214 unmodified lines
215215 return;
216216
217217 client->id = ret | ID_BIT_AUDIO;
218+ if (client->ops->gpu_bound)
219+ client->ops->gpu_bound(client->pdev, ret);
218220 }
219221
220222 vga_switcheroo_debugfs_init(&vgasr_priv);
drivers/hid/hid-apple.c+8−1
@@ -335,7 +335,8 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 334 unmodified lines
335335 struct hid_field *field, struct hid_usage *usage,
336336 unsigned long **bit, int *max)
337337 {
338− if (usage->hid == (HID_UP_CUSTOM | 0x0003)) {
338+ if (usage->hid == (HID_UP_CUSTOM | 0x0003) ||
339+ usage->hid == (HID_UP_MSVENDOR | 0x0003)) {
339340 /* The fn key on Apple USB keyboards */
340341 set_bit(EV_REP, hi->input->evbit);
341342 hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
@@ -472,6 +473,12 @@ static const struct hid_device_id apple_devices[] = { · 130 unmodified lines
472473 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
473474 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI),
474475 .driver_data = APPLE_HAS_FN },
476+ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI),
477+ .driver_data = APPLE_HAS_FN },
478+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI),
479+ .driver_data = APPLE_HAS_FN },
480+ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI),
481+ .driver_data = APPLE_HAS_FN },
475482 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
476483 .driver_data = APPLE_HAS_FN },
477484 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO),
drivers/hid/hid-core.c+4−1
@@ -1000,7 +1000,7 @@ int hid_open_report(struct hid_device *device) · 999 unmodified lines
10001000 parser = vzalloc(sizeof(struct hid_parser));
10011001 if (!parser) {
10021002 ret = -ENOMEM;
1003− goto err;
1003+ goto alloc_err;
10041004 }
10051005
10061006 parser->device = device;
@@ -1039,6 +1039,7 @@ int hid_open_report(struct hid_device *device) · 32 unmodified lines
10391039 hid_err(device, "unbalanced delimiter at end of report description\n");
10401040 goto err;
10411041 }
1042+ kfree(parser->collection_stack);
10421043 vfree(parser);
10431044 device->status |= HID_STAT_PARSED;
10441045 return 0;
@@ -1047,6 +1048,8 @@ int hid_open_report(struct hid_device *device) · 2 unmodified lines
10471048
10481049 hid_err(device, "item fetching failed at offset %d\n", (int)(end - start));
10491050 err:
1051+ kfree(parser->collection_stack);
1052+alloc_err:
10501053 vfree(parser);
10511054 hid_close_report(device);
10521055 return ret;
drivers/hid/hid-ids.h+3−3
@@ -88,6 +88,7 @@ · 87 unmodified lines
8888 #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101
8989
9090 #define USB_VENDOR_ID_APPLE 0x05ac
91+#define BT_VENDOR_ID_APPLE 0x004c
9192 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
9293 #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
9394 #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e
@@ -157,6 +158,7 @@ · 63 unmodified lines
157158 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256
158159 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257
159160 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI 0x0267
161+#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI 0x026c
160162 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
161163 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
162164 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292
@@ -528,9 +530,6 @@ · 365 unmodified lines
528530 #define I2C_VENDOR_ID_HANTICK 0x0911
529531 #define I2C_PRODUCT_ID_HANTICK_5288 0x5288
530532
531−#define I2C_VENDOR_ID_RAYD 0x2386
532−#define I2C_PRODUCT_ID_RAYD_3118 0x3118
533−
534533 #define USB_VENDOR_ID_HANWANG 0x0b57
535534 #define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000
536535 #define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff
@@ -950,6 +949,7 @@ · 413 unmodified lines
950949 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
951950 #define USB_DEVICE_ID_SAITEK_PS1000 0x0621
952951 #define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb
952+#define USB_DEVICE_ID_SAITEK_RAT7_CONTAGION 0x0ccd
953953 #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7
954954 #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa
955955 #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
drivers/hid/hid-input.c+3−2
@@ -1582,6 +1582,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid, · 1581 unmodified lines
15821582 input_dev->dev.parent = &hid->dev;
15831583
15841584 hidinput->input = input_dev;
1585+ hidinput->application = application;
15851586 list_add_tail(&hidinput->list, &hid->inputs);
15861587
15871588 INIT_LIST_HEAD(&hidinput->reports);
@@ -1677,8 +1678,7 @@ static struct hid_input *hidinput_match_application(struct hid_report *report) · 89 unmodified lines
16771678 struct hid_input *hidinput;
16781679
16791680 list_for_each_entry(hidinput, &hid->inputs, list) {
1680− if (hidinput->report &&
1681− hidinput->report->application == report->application)
1681+ if (hidinput->application == report->application)
16821682 return hidinput;
16831683 }
16841684
@@ -1815,6 +1815,7 @@ void hidinput_disconnect(struct hid_device *hid) · 130 unmodified lines
18151815 input_unregister_device(hidinput->input);
18161816 else
18171817 input_free_device(hidinput->input);
1818+ kfree(hidinput->name);
18181819 kfree(hidinput);
18191820 }
18201821
drivers/hid/hid-multitouch.c+17−2
@@ -1375,7 +1375,8 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev, · 1374 unmodified lines
13751375 struct hid_usage *usage,
13761376 enum latency_mode latency,
13771377 bool surface_switch,
1378− bool button_switch)
1378+ bool button_switch,
1379+ bool *inputmode_found)
13791380 {
13801381 struct mt_device *td = hid_get_drvdata(hdev);
13811382 struct mt_class *cls = &td->mtclass;
@@ -1387,6 +1388,14 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev, · 5 unmodified lines
13871388
13881389 switch (usage->hid) {
13891390 case HID_DG_INPUTMODE:
1391+ /*
1392+ * Some elan panels wrongly declare 2 input mode features,
1393+ * and silently ignore when we set the value in the second
1394+ * field. Skip the second feature and hope for the best.
1395+ */
1396+ if (*inputmode_found)
1397+ return false;
1398+
13901399 if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
13911400 report_len = hid_report_len(report);
13921401 buf = hid_alloc_report_buf(report, GFP_KERNEL);
@@ -1402,6 +1411,7 @@ static bool mt_need_to_apply_feature(struct hid_device *hdev, · 9 unmodified lines
14021411 }
14031412
14041413 field->value[index] = td->inputmode_value;
1414+ *inputmode_found = true;
14051415 return true;
14061416
14071417 case HID_DG_CONTACTMAX:
@@ -1439,6 +1449,7 @@ static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency, · 31 unmodified lines
14391449 struct hid_usage *usage;
14401450 int i, j;
14411451 bool update_report;
1452+ bool inputmode_found = false;
14421453
14431454 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
14441455 list_for_each_entry(rep, &rep_enum->report_list, list) {
@@ -1457,7 +1468,8 @@ static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency, · 12 unmodified lines
14571468 usage,
14581469 latency,
14591470 surface_switch,
1460− button_switch))
1471+ button_switch,
1472+ &inputmode_found))
14611473 update_report = true;
14621474 }
14631475 }
@@ -1685,6 +1697,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) · 221 unmodified lines
16851697 */
16861698 hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
16871699
1700+ if (id->group != HID_GROUP_MULTITOUCH_WIN_8)
1701+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
1702+
16881703 timer_setup(&td->release_timer, mt_expired_timeout, 0);
16891704
16901705 ret = hid_parse(hdev);
drivers/hid/hid-saitek.c+2−0
@@ -183,6 +183,8 @@ static const struct hid_device_id saitek_devices[] = { · 182 unmodified lines
183183 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
184184 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
185185 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
186+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_CONTAGION),
187+ .driver_data = SAITEK_RELEASE_MODE_RAT7 },
186188 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT9),
187189 .driver_data = SAITEK_RELEASE_MODE_RAT7 },
188190 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
drivers/hid/hid-sensor-hub.c+23−0
@@ -579,6 +579,28 @@ void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev) · 578 unmodified lines
579579 }
580580 EXPORT_SYMBOL_GPL(sensor_hub_device_close);
581581
582+static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc,
583+ unsigned int *rsize)
584+{
585+ /*
586+ * Checks if the report descriptor of Thinkpad Helix 2 has a logical
587+ * minimum for magnetic flux axis greater than the maximum.
588+ */
589+ if (hdev->product == USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA &&
590+ *rsize == 2558 && rdesc[913] == 0x17 && rdesc[914] == 0x40 &&
591+ rdesc[915] == 0x81 && rdesc[916] == 0x08 &&
592+ rdesc[917] == 0x00 && rdesc[918] == 0x27 &&
593+ rdesc[921] == 0x07 && rdesc[922] == 0x00) {
594+ /* Sets negative logical minimum for mag x, y and z */
595+ rdesc[914] = rdesc[935] = rdesc[956] = 0xc0;
596+ rdesc[915] = rdesc[936] = rdesc[957] = 0x7e;
597+ rdesc[916] = rdesc[937] = rdesc[958] = 0xf7;
598+ rdesc[917] = rdesc[938] = rdesc[959] = 0xff;
599+ }
600+
601+ return rdesc;
602+}
603+
582604 static int sensor_hub_probe(struct hid_device *hdev,
583605 const struct hid_device_id *id)
584606 {
@@ -743,6 +765,7 @@ static struct hid_driver sensor_hub_driver = { · 158 unmodified lines
743765 .probe = sensor_hub_probe,
744766 .remove = sensor_hub_remove,
745767 .raw_event = sensor_hub_raw_event,
768+ .report_fixup = sensor_hub_report_fixup,
746769 #ifdef CONFIG_PM
747770 .suspend = sensor_hub_suspend,
748771 .resume = sensor_hub_resume,
drivers/hid/i2c-hid/i2c-hid.c+7−4
@@ -170,8 +170,6 @@ static const struct i2c_hid_quirks { · 169 unmodified lines
170170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
171171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
172172 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
173− { I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118,
174− I2C_HID_QUIRK_RESEND_REPORT_DESCR },
175173 { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,
176174 I2C_HID_QUIRK_RESEND_REPORT_DESCR },
177175 { 0, 0 }
@@ -1235,11 +1233,16 @@ static int i2c_hid_resume(struct device *dev) · 1057 unmodified lines
12351233 pm_runtime_enable(dev);
12361234
12371235 enable_irq(client->irq);
1238− ret = i2c_hid_hwreset(client);
1236+
1237+ /* Instead of resetting device, simply powers the device on. This
1238+ * solves "incomplete reports" on Raydium devices 2386:3118 and
1239+ * 2386:4B33
1240+ */
1241+ ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
12391242 if (ret)
12401243 return ret;
12411244
1242− /* RAYDIUM device (2386:3118) need to re-send report descr cmd
1245+ /* Some devices need to re-send report descr cmd
12431246 * after resume, after this it will be back normal.
12441247 * otherwise it issues too many incomplete reports.
12451248 */
drivers/hid/intel-ish-hid/ipc/hw-ish.h+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #define CNL_Ax_DEVICE_ID 0x9DFC
3030 #define GLK_Ax_DEVICE_ID 0x31A2
3131 #define CNL_H_DEVICE_ID 0xA37C
32+#define SPT_H_DEVICE_ID 0xA135
3233
3334 #define REVISION_ID_CHT_A0 0x6
3435 #define REVISION_ID_CHT_Ax_SI 0x0
drivers/hid/intel-ish-hid/ipc/pci-ish.c+1−0
@@ -38,6 +38,7 @@ static const struct pci_device_id ish_pci_tbl[] = { · 37 unmodified lines
3838 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
3939 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)},
4040 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_H_DEVICE_ID)},
41+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)},
4142 {0, }
4243 };
4344 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
drivers/hv/vmbus_drv.c+3−0
@@ -1291,6 +1291,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj, · 1290 unmodified lines
12911291 if (!attribute->show)
12921292 return -EIO;
12931293
1294+ if (chan->state != CHANNEL_OPENED_STATE)
1295+ return -EINVAL;
1296+
12941297 return attribute->show(chan, buf);
12951298 }
12961299
drivers/hwmon/nct6775.c+49−23
@@ -207,8 +207,6 @@ superio_exit(int ioreg) · 206 unmodified lines
207207
208208 #define NUM_FAN 7
209209
210−#define TEMP_SOURCE_VIRTUAL 0x1f
211−
212210 /* Common and NCT6775 specific data */
213211
214212 /* Voltage min/max registers for nr=7..14 are in bank 5 */
@@ -299,8 +297,9 @@ static const u16 NCT6775_REG_PWM_READ[] = { · 84 unmodified lines
299297
300298 static const u16 NCT6775_REG_FAN[] = { 0x630, 0x632, 0x634, 0x636, 0x638 };
301299 static const u16 NCT6775_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d };
302−static const u16 NCT6775_REG_FAN_PULSES[] = { 0x641, 0x642, 0x643, 0x644, 0 };
303−static const u16 NCT6775_FAN_PULSE_SHIFT[] = { 0, 0, 0, 0, 0, 0 };
300+static const u16 NCT6775_REG_FAN_PULSES[NUM_FAN] = {
301+ 0x641, 0x642, 0x643, 0x644 };
302+static const u16 NCT6775_FAN_PULSE_SHIFT[NUM_FAN] = { };
304303
305304 static const u16 NCT6775_REG_TEMP[] = {
306305 0x27, 0x150, 0x250, 0x62b, 0x62c, 0x62d };
@@ -373,6 +372,7 @@ static const char *const nct6775_temp_label[] = { · 66 unmodified lines
373372 };
374373
375374 #define NCT6775_TEMP_MASK 0x001ffffe
375+#define NCT6775_VIRT_TEMP_MASK 0x00000000
376376
377377 static const u16 NCT6775_REG_TEMP_ALTERNATE[32] = {
378378 [13] = 0x661,
@@ -425,8 +425,8 @@ static const u8 NCT6776_PWM_MODE_MASK[] = { 0x01, 0, 0, 0, 0, 0 }; · 46 unmodified lines
425425
426426 static const u16 NCT6776_REG_FAN_MIN[] = {
427427 0x63a, 0x63c, 0x63e, 0x640, 0x642, 0x64a, 0x64c };
428−static const u16 NCT6776_REG_FAN_PULSES[] = {
429− 0x644, 0x645, 0x646, 0x647, 0x648, 0x649, 0 };
428+static const u16 NCT6776_REG_FAN_PULSES[NUM_FAN] = {
429+ 0x644, 0x645, 0x646, 0x647, 0x648, 0x649 };
430430
431431 static const u16 NCT6776_REG_WEIGHT_DUTY_BASE[] = {
432432 0x13e, 0x23e, 0x33e, 0x83e, 0x93e, 0xa3e };
@@ -461,6 +461,7 @@ static const char *const nct6776_temp_label[] = { · 28 unmodified lines
461461 };
462462
463463 #define NCT6776_TEMP_MASK 0x007ffffe
464+#define NCT6776_VIRT_TEMP_MASK 0x00000000
464465
465466 static const u16 NCT6776_REG_TEMP_ALTERNATE[32] = {
466467 [14] = 0x401,
@@ -501,9 +502,9 @@ static const s8 NCT6779_BEEP_BITS[] = { · 34 unmodified lines
501502 30, 31 }; /* intrusion0, intrusion1 */
502503
503504 static const u16 NCT6779_REG_FAN[] = {
504− 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x660 };
505−static const u16 NCT6779_REG_FAN_PULSES[] = {
506− 0x644, 0x645, 0x646, 0x647, 0x648, 0x649, 0 };
505+ 0x4c0, 0x4c2, 0x4c4, 0x4c6, 0x4c8, 0x4ca, 0x4ce };
506+static const u16 NCT6779_REG_FAN_PULSES[NUM_FAN] = {
507+ 0x644, 0x645, 0x646, 0x647, 0x648, 0x649 };
507508
508509 static const u16 NCT6779_REG_CRITICAL_PWM_ENABLE[] = {
509510 0x136, 0x236, 0x336, 0x836, 0x936, 0xa36, 0xb36 };
@@ -559,7 +560,9 @@ static const char *const nct6779_temp_label[] = { · 49 unmodified lines
559560 };
560561
561562 #define NCT6779_TEMP_MASK 0x07ffff7e
563+#define NCT6779_VIRT_TEMP_MASK 0x00000000
562564 #define NCT6791_TEMP_MASK 0x87ffff7e
565+#define NCT6791_VIRT_TEMP_MASK 0x80000000
563566
564567 static const u16 NCT6779_REG_TEMP_ALTERNATE[32]
565568 = { 0x490, 0x491, 0x492, 0x493, 0x494, 0x495, 0, 0,
@@ -638,6 +641,7 @@ static const char *const nct6792_temp_label[] = { · 72 unmodified lines
638641 };
639642
640643 #define NCT6792_TEMP_MASK 0x9fffff7e
644+#define NCT6792_VIRT_TEMP_MASK 0x80000000
641645
642646 static const char *const nct6793_temp_label[] = {
643647 "",
@@ -675,6 +679,7 @@ static const char *const nct6793_temp_label[] = { · 31 unmodified lines
675679 };
676680
677681 #define NCT6793_TEMP_MASK 0xbfff037e
682+#define NCT6793_VIRT_TEMP_MASK 0x80000000
678683
679684 static const char *const nct6795_temp_label[] = {
680685 "",
@@ -712,6 +717,7 @@ static const char *const nct6795_temp_label[] = { · 31 unmodified lines
712717 };
713718
714719 #define NCT6795_TEMP_MASK 0xbfffff7e
720+#define NCT6795_VIRT_TEMP_MASK 0x80000000
715721
716722 static const char *const nct6796_temp_label[] = {
717723 "",
@@ -724,8 +730,8 @@ static const char *const nct6796_temp_label[] = { · 6 unmodified lines
724730 "AUXTIN4",
725731 "SMBUSMASTER 0",
726732 "SMBUSMASTER 1",
727− "",
728− "",
733+ "Virtual_TEMP",
734+ "Virtual_TEMP",
729735 "",
730736 "",
731737 "",
@@ -748,7 +754,8 @@ static const char *const nct6796_temp_label[] = { · 16 unmodified lines
748754 "Virtual_TEMP"
749755 };
750756
751−#define NCT6796_TEMP_MASK 0xbfff03fe
757+#define NCT6796_TEMP_MASK 0xbfff0ffe
758+#define NCT6796_VIRT_TEMP_MASK 0x80000c00
752759
753760 /* NCT6102D/NCT6106D specific data */
754761
@@ -779,8 +786,8 @@ static const u16 NCT6106_REG_TEMP_CONFIG[] = { · 24 unmodified lines
779786
780787 static const u16 NCT6106_REG_FAN[] = { 0x20, 0x22, 0x24 };
781788 static const u16 NCT6106_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4 };
782−static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0, 0 };
783−static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4, 0, 0 };
789+static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6 };
790+static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4 };
784791
785792 static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
786793 static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
@@ -917,6 +924,11 @@ static unsigned int fan_from_reg16(u16 reg, unsigned int divreg) · 130 unmodified lines
917924 return 1350000U / (reg << divreg);
918925 }
919926
927+static unsigned int fan_from_reg_rpm(u16 reg, unsigned int divreg)
928+{
929+ return reg;
930+}
931+
920932 static u16 fan_to_reg(u32 fan, unsigned int divreg)
921933 {
922934 if (!fan)
@@ -969,6 +981,7 @@ struct nct6775_data { · 46 unmodified lines
969981 u16 reg_temp_config[NUM_TEMP];
970982 const char * const *temp_label;
971983 u32 temp_mask;
984+ u32 virt_temp_mask;
972985
973986 u16 REG_CONFIG;
974987 u16 REG_VBAT;
@@ -1276,11 +1289,11 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) · 301 unmodified lines
12761289 case nct6795:
12771290 case nct6796:
12781291 return reg == 0x150 || reg == 0x153 || reg == 0x155 ||
1279− ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) ||
1292+ (reg & 0xfff0) == 0x4c0 ||
12801293 reg == 0x402 ||
12811294 reg == 0x63a || reg == 0x63c || reg == 0x63e ||
12821295 reg == 0x640 || reg == 0x642 || reg == 0x64a ||
1283− reg == 0x64c || reg == 0x660 ||
1296+ reg == 0x64c ||
12841297 reg == 0x73 || reg == 0x75 || reg == 0x77 || reg == 0x79 ||
12851298 reg == 0x7b || reg == 0x7d;
12861299 }
@@ -1558,7 +1571,7 @@ static void nct6775_update_pwm(struct device *dev) · 271 unmodified lines
15581571 reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]);
15591572 data->pwm_weight_temp_sel[i] = reg & 0x1f;
15601573 /* If weight is disabled, report weight source as 0 */
1561− if (j == 1 && !(reg & 0x80))
1574+ if (!(reg & 0x80))
15621575 data->pwm_weight_temp_sel[i] = 0;
15631576
15641577 /* Weight temp data */
@@ -1682,9 +1695,13 @@ static struct nct6775_data *nct6775_update_device(struct device *dev) · 117 unmodified lines
16821695 if (data->has_fan_min & BIT(i))
16831696 data->fan_min[i] = nct6775_read_value(data,
16841697 data->REG_FAN_MIN[i]);
1685− data->fan_pulses[i] =
1686− (nct6775_read_value(data, data->REG_FAN_PULSES[i])
1687− >> data->FAN_PULSE_SHIFT[i]) & 0x03;
1698+
1699+ if (data->REG_FAN_PULSES[i]) {
1700+ data->fan_pulses[i] =
1701+ (nct6775_read_value(data,
1702+ data->REG_FAN_PULSES[i])
1703+ >> data->FAN_PULSE_SHIFT[i]) & 0x03;
1704+ }
16881705
16891706 nct6775_select_fan_div(dev, data, i, reg);
16901707 }
@@ -3639,6 +3656,7 @@ static int nct6775_probe(struct platform_device *pdev) · 1948 unmodified lines
36393656
36403657 data->temp_label = nct6776_temp_label;
36413658 data->temp_mask = NCT6776_TEMP_MASK;
3659+ data->virt_temp_mask = NCT6776_VIRT_TEMP_MASK;
36423660
36433661 data->REG_VBAT = NCT6106_REG_VBAT;
36443662 data->REG_DIODE = NCT6106_REG_DIODE;
@@ -3717,6 +3735,7 @@ static int nct6775_probe(struct platform_device *pdev) · 72 unmodified lines
37173735
37183736 data->temp_label = nct6775_temp_label;
37193737 data->temp_mask = NCT6775_TEMP_MASK;
3738+ data->virt_temp_mask = NCT6775_VIRT_TEMP_MASK;
37203739
37213740 data->REG_CONFIG = NCT6775_REG_CONFIG;
37223741 data->REG_VBAT = NCT6775_REG_VBAT;
@@ -3789,6 +3808,7 @@ static int nct6775_probe(struct platform_device *pdev) · 66 unmodified lines
37893808
37903809 data->temp_label = nct6776_temp_label;
37913810 data->temp_mask = NCT6776_TEMP_MASK;
3811+ data->virt_temp_mask = NCT6776_VIRT_TEMP_MASK;
37923812
37933813 data->REG_CONFIG = NCT6775_REG_CONFIG;
37943814 data->REG_VBAT = NCT6775_REG_VBAT;
@@ -3853,7 +3873,7 @@ static int nct6775_probe(struct platform_device *pdev) · 58 unmodified lines
38533873 data->ALARM_BITS = NCT6779_ALARM_BITS;
38543874 data->BEEP_BITS = NCT6779_BEEP_BITS;
38553875
3856− data->fan_from_reg = fan_from_reg13;
3876+ data->fan_from_reg = fan_from_reg_rpm;
38573877 data->fan_from_reg_min = fan_from_reg13;
38583878 data->target_temp_mask = 0xff;
38593879 data->tolerance_mask = 0x07;
@@ -3861,6 +3881,7 @@ static int nct6775_probe(struct platform_device *pdev) · 1 unmodified line
38613881
38623882 data->temp_label = nct6779_temp_label;
38633883 data->temp_mask = NCT6779_TEMP_MASK;
3884+ data->virt_temp_mask = NCT6779_VIRT_TEMP_MASK;
38643885
38653886 data->REG_CONFIG = NCT6775_REG_CONFIG;
38663887 data->REG_VBAT = NCT6775_REG_VBAT;
@@ -3933,7 +3954,7 @@ static int nct6775_probe(struct platform_device *pdev) · 66 unmodified lines
39333954 data->ALARM_BITS = NCT6791_ALARM_BITS;
39343955 data->BEEP_BITS = NCT6779_BEEP_BITS;
39353956
3936− data->fan_from_reg = fan_from_reg13;
3957+ data->fan_from_reg = fan_from_reg_rpm;
39373958 data->fan_from_reg_min = fan_from_reg13;
39383959 data->target_temp_mask = 0xff;
39393960 data->tolerance_mask = 0x07;
@@ -3944,22 +3965,27 @@ static int nct6775_probe(struct platform_device *pdev) · 4 unmodified lines
39443965 case nct6791:
39453966 data->temp_label = nct6779_temp_label;
39463967 data->temp_mask = NCT6791_TEMP_MASK;
3968+ data->virt_temp_mask = NCT6791_VIRT_TEMP_MASK;
39473969 break;
39483970 case nct6792:
39493971 data->temp_label = nct6792_temp_label;
39503972 data->temp_mask = NCT6792_TEMP_MASK;
3973+ data->virt_temp_mask = NCT6792_VIRT_TEMP_MASK;
39513974 break;
39523975 case nct6793:
39533976 data->temp_label = nct6793_temp_label;
39543977 data->temp_mask = NCT6793_TEMP_MASK;
3978+ data->virt_temp_mask = NCT6793_VIRT_TEMP_MASK;
39553979 break;
39563980 case nct6795:
39573981 data->temp_label = nct6795_temp_label;
39583982 data->temp_mask = NCT6795_TEMP_MASK;
3983+ data->virt_temp_mask = NCT6795_VIRT_TEMP_MASK;
39593984 break;
39603985 case nct6796:
39613986 data->temp_label = nct6796_temp_label;
39623987 data->temp_mask = NCT6796_TEMP_MASK;
3988+ data->virt_temp_mask = NCT6796_VIRT_TEMP_MASK;
39633989 break;
39643990 }
39653991
@@ -4143,7 +4169,7 @@ static int nct6775_probe(struct platform_device *pdev) · 177 unmodified lines
41434169 * for each fan reflects a different temperature, and there
41444170 * are no duplicates.
41454171 */
4146− if (src != TEMP_SOURCE_VIRTUAL) {
4172+ if (!(data->virt_temp_mask & BIT(src))) {
41474173 if (mask & BIT(src))
41484174 continue;
41494175 mask |= BIT(src);
drivers/hwmon/raspberrypi-hwmon.c+1−0
@@ -164,3 +164,4 @@ module_platform_driver(rpi_hwmon_driver); · 163 unmodified lines
164164 MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
165165 MODULE_DESCRIPTION("Raspberry Pi voltage sensor driver");
166166 MODULE_LICENSE("GPL v2");
167+MODULE_ALIAS("platform:raspberrypi-hwmon");
drivers/hwtracing/intel_th/core.c+13−3
@@ -139,7 +139,8 @@ static int intel_th_remove(struct device *dev) · 138 unmodified lines
139139 th->thdev[i] = NULL;
140140 }
141141
142− th->num_thdevs = lowest;
142+ if (lowest >= 0)
143+ th->num_thdevs = lowest;
143144 }
144145
145146 if (thdrv->attr_group)
@@ -487,7 +488,7 @@ static const struct intel_th_subdevice { · 341 unmodified lines
487488 .flags = IORESOURCE_MEM,
488489 },
489490 {
490− .start = TH_MMIO_SW,
491+ .start = 1, /* use resource[1] */
491492 .end = 0,
492493 .flags = IORESOURCE_MEM,
493494 },
@@ -580,6 +581,7 @@ intel_th_subdevice_alloc(struct intel_th *th, · 86 unmodified lines
580581 struct intel_th_device *thdev;
581582 struct resource res[3];
582583 unsigned int req = 0;
584+ bool is64bit = false;
583585 int r, err;
584586
585587 thdev = intel_th_device_alloc(th, subdev->type, subdev->name,
@@ -589,12 +591,18 @@ intel_th_subdevice_alloc(struct intel_th *th, · 3 unmodified lines
589591
590592 thdev->drvdata = th->drvdata;
591593
594+ for (r = 0; r < th->num_resources; r++)
595+ if (th->resource[r].flags & IORESOURCE_MEM_64) {
596+ is64bit = true;
597+ break;
598+ }
599+
592600 memcpy(res, subdev->res,
593601 sizeof(struct resource) * subdev->nres);
594602
595603 for (r = 0; r < subdev->nres; r++) {
596604 struct resource *devres = th->resource;
597− int bar = TH_MMIO_CONFIG;
605+ int bar = 0; /* cut subdevices' MMIO from resource[0] */
598606
599607 /*
600608 * Take .end == 0 to mean 'take the whole bar',
@@ -603,6 +611,8 @@ intel_th_subdevice_alloc(struct intel_th *th, · 2 unmodified lines
603611 */
604612 if (!res[r].end && res[r].flags == IORESOURCE_MEM) {
605613 bar = res[r].start;
614+ if (is64bit)
615+ bar *= 2;
606616 res[r].start = 0;
607617 res[r].end = resource_size(&devres[bar]) - 1;
608618 }
drivers/hwtracing/intel_th/pci.c+5−0
@@ -160,6 +160,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 159 unmodified lines
160160 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x18e1),
161161 .driver_data = (kernel_ulong_t)&intel_th_2x,
162162 },
163+ {
164+ /* Ice Lake PCH */
165+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x34a6),
166+ .driver_data = (kernel_ulong_t)&intel_th_2x,
167+ },
163168 { 0 },
164169 };
165170
drivers/i2c/busses/i2c-i801.c+6−1
@@ -140,6 +140,7 @@ · 139 unmodified lines
140140
141141 #define SBREG_BAR 0x10
142142 #define SBREG_SMBCTRL 0xc6000c
143+#define SBREG_SMBCTRL_DNV 0xcf000c
143144
144145 /* Host status bits for SMBPCISTS */
145146 #define SMBPCISTS_INTS BIT(3)
@@ -1399,7 +1400,11 @@ static void i801_add_tco(struct i801_priv *priv) · 1253 unmodified lines
13991400 spin_unlock(&p2sb_spinlock);
14001401
14011402 res = &tco_res[ICH_RES_MEM_OFF];
1402− res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
1403+ if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
1404+ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
1405+ else
1406+ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
1407+
14031408 res->end = res->start + 3;
14041409 res->flags = IORESOURCE_MEM;
14051410
drivers/i2c/busses/i2c-imx-lpi2c.c+0−1
@@ -538,7 +538,6 @@ static const struct i2c_algorithm lpi2c_imx_algo = { · 537 unmodified lines
538538
539539 static const struct of_device_id lpi2c_imx_of_match[] = {
540540 { .compatible = "fsl,imx7ulp-lpi2c" },
541− { .compatible = "fsl,imx8dv-lpi2c" },
542541 { },
543542 };
544543 MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match);
drivers/i2c/busses/i2c-uniphier-f.c+2−5
@@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, · 400 unmodified lines
401401 return ret;
402402
403403 for (msg = msgs; msg < emsg; msg++) {
404− /* If next message is read, skip the stop condition */
405− bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
406− /* but, force it if I2C_M_STOP is set */
407− if (msg->flags & I2C_M_STOP)
408− stop = true;
404+ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
405+ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
409406
410407 ret = uniphier_fi2c_master_xfer_one(adap, msg, stop);
411408 if (ret)
drivers/i2c/busses/i2c-uniphier.c+2−5
@@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, · 247 unmodified lines
248248 return ret;
249249
250250 for (msg = msgs; msg < emsg; msg++) {
251− /* If next message is read, skip the stop condition */
252− bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
253− /* but, force it if I2C_M_STOP is set */
254− if (msg->flags & I2C_M_STOP)
255− stop = true;
251+ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
252+ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
256253
257254 ret = uniphier_i2c_master_xfer_one(adap, msg, stop);
258255 if (ret)
drivers/i2c/busses/i2c-xiic.c+4−0
@@ -532,6 +532,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) · 531 unmodified lines
532532 {
533533 u8 rx_watermark;
534534 struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
535+ unsigned long flags;
535536
536537 /* Clear and enable Rx full interrupt. */
537538 xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK);
@@ -547,6 +548,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) · 9 unmodified lines
547548 rx_watermark = IIC_RX_FIFO_DEPTH;
548549 xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1);
549550
551+ local_irq_save(flags);
550552 if (!(msg->flags & I2C_M_NOSTART))
551553 /* write the address */
552554 xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
@@ -556,6 +558,8 @@ static void xiic_start_recv(struct xiic_i2c *i2c) · 3 unmodified lines
556558
557559 xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
558560 msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0));
561+ local_irq_restore(flags);
562+
559563 if (i2c->nmsgs == 1)
560564 /* very last, enable bus not busy as well */
561565 xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK);
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c+6−7
@@ -187,12 +187,15 @@ static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor, · 186 unmodified lines
187187
188188 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
189189 {
190− u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
190+ u16 fifo_watermark = ~0, cur_watermark, fifo_th_mask;
191191 struct st_lsm6dsx_hw *hw = sensor->hw;
192192 struct st_lsm6dsx_sensor *cur_sensor;
193193 int i, err, data;
194194 __le16 wdata;
195195
196+ if (!hw->sip)
197+ return 0;
198+
196199 for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
197200 cur_sensor = iio_priv(hw->iio_devs[i]);
198201
@@ -203,14 +206,10 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark) · 4 unmodified lines
203206 : cur_sensor->watermark;
204207
205208 fifo_watermark = min_t(u16, fifo_watermark, cur_watermark);
206− sip += cur_sensor->sip;
207209 }
208210
209− if (!sip)
210− return 0;
211−
212− fifo_watermark = max_t(u16, fifo_watermark, sip);
213− fifo_watermark = (fifo_watermark / sip) * sip;
211+ fifo_watermark = max_t(u16, fifo_watermark, hw->sip);
212+ fifo_watermark = (fifo_watermark / hw->sip) * hw->sip;
214213 fifo_watermark = fifo_watermark * hw->settings->fifo_ops.th_wl;
215214
216215 err = regmap_read(hw->regmap, hw->settings->fifo_ops.fifo_th.addr + 1,
drivers/iio/temperature/maxim_thermocouple.c+0−1
@@ -258,7 +258,6 @@ static int maxim_thermocouple_remove(struct spi_device *spi) · 257 unmodified lines
258258 static const struct spi_device_id maxim_thermocouple_id[] = {
259259 {"max6675", MAX6675},
260260 {"max31855", MAX31855},
261− {"max31856", MAX31855},
262261 {},
263262 };
264263 MODULE_DEVICE_TABLE(spi, maxim_thermocouple_id);
drivers/infiniband/core/cache.c+34−34
@@ -337,6 +337,39 @@ static int add_roce_gid(struct ib_gid_table_entry *entry) · 336 unmodified lines
337337 return 0;
338338 }
339339
340+/**
341+ * del_gid - Delete GID table entry
342+ *
343+ * @ib_dev: IB device whose GID entry to be deleted
344+ * @port: Port number of the IB device
345+ * @table: GID table of the IB device for a port
346+ * @ix: GID entry index to delete
347+ *
348+ */
349+static void del_gid(struct ib_device *ib_dev, u8 port,
350+ struct ib_gid_table *table, int ix)
351+{
352+ struct ib_gid_table_entry *entry;
353+
354+ lockdep_assert_held(&table->lock);
355+
356+ pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__,
357+ ib_dev->name, port, ix,
358+ table->data_vec[ix]->attr.gid.raw);
359+
360+ write_lock_irq(&table->rwlock);
361+ entry = table->data_vec[ix];
362+ entry->state = GID_TABLE_ENTRY_PENDING_DEL;
363+ /*
364+ * For non RoCE protocol, GID entry slot is ready to use.
365+ */
366+ if (!rdma_protocol_roce(ib_dev, port))
367+ table->data_vec[ix] = NULL;
368+ write_unlock_irq(&table->rwlock);
369+
370+ put_gid_entry_locked(entry);
371+}
372+
340373 /**
341374 * add_modify_gid - Add or modify GID table entry
342375 *
@@ -358,7 +391,7 @@ static int add_modify_gid(struct ib_gid_table *table, · 15 unmodified lines
358391 * this index.
359392 */
360393 if (is_gid_entry_valid(table->data_vec[attr->index]))
361− put_gid_entry(table->data_vec[attr->index]);
394+ del_gid(attr->device, attr->port_num, table, attr->index);
362395
363396 /*
364397 * Some HCA's report multiple GID entries with only one valid GID, and
@@ -386,39 +419,6 @@ done: · 21 unmodified lines
386419 return ret;
387420 }
388421
389−/**
390− * del_gid - Delete GID table entry
391− *
392− * @ib_dev: IB device whose GID entry to be deleted
393− * @port: Port number of the IB device
394− * @table: GID table of the IB device for a port
395− * @ix: GID entry index to delete
396− *
397− */
398−static void del_gid(struct ib_device *ib_dev, u8 port,
399− struct ib_gid_table *table, int ix)
400−{
401− struct ib_gid_table_entry *entry;
402−
403− lockdep_assert_held(&table->lock);
404−
405− pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__,
406− ib_dev->name, port, ix,
407− table->data_vec[ix]->attr.gid.raw);
408−
409− write_lock_irq(&table->rwlock);
410− entry = table->data_vec[ix];
411− entry->state = GID_TABLE_ENTRY_PENDING_DEL;
412− /*
413− * For non RoCE protocol, GID entry slot is ready to use.
414− */
415− if (!rdma_protocol_roce(ib_dev, port))
416− table->data_vec[ix] = NULL;
417− write_unlock_irq(&table->rwlock);
418−
419− put_gid_entry_locked(entry);
420−}
421−
422422 /* rwlock should be read locked, or lock should be held */
423423 static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
424424 const struct ib_gid_attr *val, bool default_gid,
drivers/infiniband/core/cma.c+7−5
@@ -724,6 +724,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) · 723 unmodified lines
724724 dgid = (union ib_gid *) &addr->sib_addr;
725725 pkey = ntohs(addr->sib_pkey);
726726
727+ mutex_lock(&lock);
727728 list_for_each_entry(cur_dev, &dev_list, list) {
728729 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
729730 if (!rdma_cap_af_ib(cur_dev->device, p))
@@ -750,18 +751,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) · 20 unmodified lines
750751 cma_dev = cur_dev;
751752 sgid = gid;
752753 id_priv->id.port_num = p;
754+ goto found;
753755 }
754756 }
755757 }
756758 }
757−
758− if (!cma_dev)
759− return -ENODEV;
759+ mutex_unlock(&lock);
760+ return -ENODEV;
760761
761762 found:
762763 cma_attach_to_dev(id_priv, cma_dev);
763− addr = (struct sockaddr_ib *) cma_src_addr(id_priv);
764− memcpy(&addr->sib_addr, &sgid, sizeof sgid);
764+ mutex_unlock(&lock);
765+ addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
766+ memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
765767 cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
766768 return 0;
767769 }
drivers/infiniband/core/rdma_core.c+2−0
@@ -882,6 +882,8 @@ static int __uverbs_cleanup_ufile(struct ib_uverbs_file *ufile, · 881 unmodified lines
882882 WARN_ON(uverbs_try_lock_object(obj, UVERBS_LOOKUP_WRITE));
883883 if (!uverbs_destroy_uobject(obj, reason))
884884 ret = 0;
885+ else
886+ atomic_set(&obj->usecnt, 0);
885887 }
886888 return ret;
887889 }
drivers/infiniband/core/ucma.c+8−0
@@ -124,6 +124,8 @@ static DEFINE_MUTEX(mut); · 123 unmodified lines
124124 static DEFINE_IDR(ctx_idr);
125125 static DEFINE_IDR(multicast_idr);
126126
127+static const struct file_operations ucma_fops;
128+
127129 static inline struct ucma_context *_ucma_find_context(int id,
128130 struct ucma_file *file)
129131 {
@@ -1581,6 +1583,10 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file, · 1451 unmodified lines
15811583 f = fdget(cmd.fd);
15821584 if (!f.file)
15831585 return -ENOENT;
1586+ if (f.file->f_op != &ucma_fops) {
1587+ ret = -EINVAL;
1588+ goto file_put;
1589+ }
15841590
15851591 /* Validate current fd and prevent destruction of id. */
15861592 ctx = ucma_get_ctx(f.file->private_data, cmd.id);
@@ -1753,6 +1759,8 @@ static int ucma_close(struct inode *inode, struct file *filp) · 166 unmodified lines
17531759 mutex_lock(&mut);
17541760 if (!ctx->closing) {
17551761 mutex_unlock(&mut);
1762+ ucma_put_ctx(ctx);
1763+ wait_for_completion(&ctx->comp);
17561764 /* rdma_destroy_id ensures that no event handlers are
17571765 * inflight for that id before releasing it.
17581766 */
drivers/infiniband/core/uverbs_cmd.c+45−23
@@ -2027,33 +2027,55 @@ static int modify_qp(struct ib_uverbs_file *file, · 2026 unmodified lines
20272027
20282028 if ((cmd->base.attr_mask & IB_QP_CUR_STATE &&
20292029 cmd->base.cur_qp_state > IB_QPS_ERR) ||
2030− cmd->base.qp_state > IB_QPS_ERR) {
2030+ (cmd->base.attr_mask & IB_QP_STATE &&
2031+ cmd->base.qp_state > IB_QPS_ERR)) {
20312032 ret = -EINVAL;
20322033 goto release_qp;
20332034 }
20342035
2035− attr->qp_state = cmd->base.qp_state;
2036− attr->cur_qp_state = cmd->base.cur_qp_state;
2037− attr->path_mtu = cmd->base.path_mtu;
2038− attr->path_mig_state = cmd->base.path_mig_state;
2039− attr->qkey = cmd->base.qkey;
2040− attr->rq_psn = cmd->base.rq_psn;
2041− attr->sq_psn = cmd->base.sq_psn;
2042− attr->dest_qp_num = cmd->base.dest_qp_num;
2043− attr->qp_access_flags = cmd->base.qp_access_flags;
2044− attr->pkey_index = cmd->base.pkey_index;
2045− attr->alt_pkey_index = cmd->base.alt_pkey_index;
2046− attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify;
2047− attr->max_rd_atomic = cmd->base.max_rd_atomic;
2048− attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic;
2049− attr->min_rnr_timer = cmd->base.min_rnr_timer;
2050− attr->port_num = cmd->base.port_num;
2051− attr->timeout = cmd->base.timeout;
2052− attr->retry_cnt = cmd->base.retry_cnt;
2053− attr->rnr_retry = cmd->base.rnr_retry;
2054− attr->alt_port_num = cmd->base.alt_port_num;
2055− attr->alt_timeout = cmd->base.alt_timeout;
2056− attr->rate_limit = cmd->rate_limit;
2036+ if (cmd->base.attr_mask & IB_QP_STATE)
2037+ attr->qp_state = cmd->base.qp_state;
2038+ if (cmd->base.attr_mask & IB_QP_CUR_STATE)
2039+ attr->cur_qp_state = cmd->base.cur_qp_state;
2040+ if (cmd->base.attr_mask & IB_QP_PATH_MTU)
2041+ attr->path_mtu = cmd->base.path_mtu;
2042+ if (cmd->base.attr_mask & IB_QP_PATH_MIG_STATE)
2043+ attr->path_mig_state = cmd->base.path_mig_state;
2044+ if (cmd->base.attr_mask & IB_QP_QKEY)
2045+ attr->qkey = cmd->base.qkey;
2046+ if (cmd->base.attr_mask & IB_QP_RQ_PSN)
2047+ attr->rq_psn = cmd->base.rq_psn;
2048+ if (cmd->base.attr_mask & IB_QP_SQ_PSN)
2049+ attr->sq_psn = cmd->base.sq_psn;
2050+ if (cmd->base.attr_mask & IB_QP_DEST_QPN)
2051+ attr->dest_qp_num = cmd->base.dest_qp_num;
2052+ if (cmd->base.attr_mask & IB_QP_ACCESS_FLAGS)
2053+ attr->qp_access_flags = cmd->base.qp_access_flags;
2054+ if (cmd->base.attr_mask & IB_QP_PKEY_INDEX)
2055+ attr->pkey_index = cmd->base.pkey_index;
2056+ if (cmd->base.attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY)
2057+ attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify;
2058+ if (cmd->base.attr_mask & IB_QP_MAX_QP_RD_ATOMIC)
2059+ attr->max_rd_atomic = cmd->base.max_rd_atomic;
2060+ if (cmd->base.attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
2061+ attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic;
2062+ if (cmd->base.attr_mask & IB_QP_MIN_RNR_TIMER)
2063+ attr->min_rnr_timer = cmd->base.min_rnr_timer;
2064+ if (cmd->base.attr_mask & IB_QP_PORT)
2065+ attr->port_num = cmd->base.port_num;
2066+ if (cmd->base.attr_mask & IB_QP_TIMEOUT)
2067+ attr->timeout = cmd->base.timeout;
2068+ if (cmd->base.attr_mask & IB_QP_RETRY_CNT)
2069+ attr->retry_cnt = cmd->base.retry_cnt;
2070+ if (cmd->base.attr_mask & IB_QP_RNR_RETRY)
2071+ attr->rnr_retry = cmd->base.rnr_retry;
2072+ if (cmd->base.attr_mask & IB_QP_ALT_PATH) {
2073+ attr->alt_port_num = cmd->base.alt_port_num;
2074+ attr->alt_timeout = cmd->base.alt_timeout;
2075+ attr->alt_pkey_index = cmd->base.alt_pkey_index;
2076+ }
2077+ if (cmd->base.attr_mask & IB_QP_RATE_LIMIT)
2078+ attr->rate_limit = cmd->rate_limit;
20572079
20582080 if (cmd->base.attr_mask & IB_QP_AV)
20592081 copy_ah_attr_from_uverbs(qp->device, &attr->ah_attr,
drivers/infiniband/core/uverbs_main.c+3−3
@@ -440,6 +440,7 @@ static int ib_uverbs_comp_event_close(struct inode *inode, struct file *filp) · 439 unmodified lines
440440 list_del(&entry->obj_list);
441441 kfree(entry);
442442 }
443+ file->ev_queue.is_closed = 1;
443444 spin_unlock_irq(&file->ev_queue.lock);
444445
445446 uverbs_close_fd(filp);
@@ -1050,7 +1051,7 @@ static void ib_uverbs_add_one(struct ib_device *device) · 604 unmodified lines
10501051 uverbs_dev->num_comp_vectors = device->num_comp_vectors;
10511052
10521053 if (ib_uverbs_create_uapi(device, uverbs_dev))
1053− goto err;
1054+ goto err_uapi;
10541055
10551056 cdev_init(&uverbs_dev->cdev, NULL);
10561057 uverbs_dev->cdev.owner = THIS_MODULE;
@@ -1077,11 +1078,10 @@ static void ib_uverbs_add_one(struct ib_device *device) · 20 unmodified lines
10771078
10781079 err_class:
10791080 device_destroy(uverbs_class, uverbs_dev->cdev.dev);
1080−
10811081 err_cdev:
10821082 cdev_del(&uverbs_dev->cdev);
1083+err_uapi:
10831084 clear_bit(devnum, dev_map);
1084−
10851085 err:
10861086 if (atomic_dec_and_test(&uverbs_dev->refcount))
10871087 ib_uverbs_comp_dev(uverbs_dev);
drivers/infiniband/core/uverbs_uapi.c+1−0
@@ -248,6 +248,7 @@ void uverbs_destroy_api(struct uverbs_api *uapi) · 247 unmodified lines
248248 kfree(rcu_dereference_protected(*slot, true));
249249 radix_tree_iter_delete(&uapi->radix, &iter, slot);
250250 }
251+ kfree(uapi);
251252 }
252253
253254 struct uverbs_api *uverbs_alloc_api(
drivers/infiniband/hw/bnxt_re/ib_verbs.c+2−0
@@ -833,6 +833,8 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp) · 832 unmodified lines
833833 "Failed to destroy Shadow QP");
834834 return rc;
835835 }
836+ bnxt_qplib_free_qp_res(&rdev->qplib_res,
837+ &rdev->qp1_sqp->qplib_qp);
836838 mutex_lock(&rdev->qp_lock);
837839 list_del(&rdev->qp1_sqp->list);
838840 atomic_dec(&rdev->qp_count);
drivers/infiniband/hw/bnxt_re/main.c+38−55
@@ -78,7 +78,7 @@ static struct list_head bnxt_re_dev_list = LIST_HEAD_INIT(bnxt_re_dev_list); · 77 unmodified lines
7878 /* Mutex to protect the list of bnxt_re devices added */
7979 static DEFINE_MUTEX(bnxt_re_dev_lock);
8080 static struct workqueue_struct *bnxt_re_wq;
81−static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait);
81+static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev);
8282
8383 /* SR-IOV helper functions */
8484
@@ -182,7 +182,7 @@ static void bnxt_re_shutdown(void *p) · 97 unmodified lines
182182 if (!rdev)
183183 return;
184184
185− bnxt_re_ib_unreg(rdev, false);
185+ bnxt_re_ib_unreg(rdev);
186186 }
187187
188188 static void bnxt_re_stop_irq(void *handle)
@@ -251,7 +251,7 @@ static struct bnxt_ulp_ops bnxt_re_ulp_ops = { · 62 unmodified lines
251251 /* Driver registration routines used to let the networking driver (bnxt_en)
252252 * to know that the RoCE driver is now installed
253253 */
254−static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait)
254+static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev)
255255 {
256256 struct bnxt_en_dev *en_dev;
257257 int rc;
@@ -260,14 +260,9 @@ static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait) · 2 unmodified lines
260260 return -EINVAL;
261261
262262 en_dev = rdev->en_dev;
263− /* Acquire rtnl lock if it is not invokded from netdev event */
264− if (lock_wait)
265− rtnl_lock();
266263
267264 rc = en_dev->en_ops->bnxt_unregister_device(rdev->en_dev,
268265 BNXT_ROCE_ULP);
269− if (lock_wait)
270− rtnl_unlock();
271266 return rc;
272267 }
273268
@@ -281,14 +276,12 @@ static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev) · 7 unmodified lines
281276
282277 en_dev = rdev->en_dev;
283278
284− rtnl_lock();
285279 rc = en_dev->en_ops->bnxt_register_device(en_dev, BNXT_ROCE_ULP,
286280 &bnxt_re_ulp_ops, rdev);
287− rtnl_unlock();
288281 return rc;
289282 }
290283
291−static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait)
284+static int bnxt_re_free_msix(struct bnxt_re_dev *rdev)
292285 {
293286 struct bnxt_en_dev *en_dev;
294287 int rc;
@@ -298,13 +291,9 @@ static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait) · 3 unmodified lines
298291
299292 en_dev = rdev->en_dev;
300293
301− if (lock_wait)
302− rtnl_lock();
303294
304295 rc = en_dev->en_ops->bnxt_free_msix(rdev->en_dev, BNXT_ROCE_ULP);
305296
306− if (lock_wait)
307− rtnl_unlock();
308297 return rc;
309298 }
310299
@@ -320,7 +309,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev) · 9 unmodified lines
320309
321310 num_msix_want = min_t(u32, BNXT_RE_MAX_MSIX, num_online_cpus());
322311
323− rtnl_lock();
324312 num_msix_got = en_dev->en_ops->bnxt_request_msix(en_dev, BNXT_ROCE_ULP,
325313 rdev->msix_entries,
326314 num_msix_want);
@@ -335,7 +323,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev) · 8 unmodified lines
335323 }
336324 rdev->num_msix = num_msix_got;
337325 done:
338− rtnl_unlock();
339326 return rc;
340327 }
341328
@@ -358,24 +345,18 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg, · 16 unmodified lines
358345 fw_msg->timeout = timeout;
359346 }
360347
361−static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id,
362− bool lock_wait)
348+static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id)
363349 {
364350 struct bnxt_en_dev *en_dev = rdev->en_dev;
365351 struct hwrm_ring_free_input req = {0};
366352 struct hwrm_ring_free_output resp;
367353 struct bnxt_fw_msg fw_msg;
368− bool do_unlock = false;
369354 int rc = -EINVAL;
370355
371356 if (!en_dev)
372357 return rc;
373358
374359 memset(&fw_msg, 0, sizeof(fw_msg));
375− if (lock_wait) {
376− rtnl_lock();
377− do_unlock = true;
378− }
379360
380361 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_FREE, -1, -1);
381362 req.ring_type = RING_ALLOC_REQ_RING_TYPE_L2_CMPL;
@@ -386,8 +367,6 @@ static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, · 4 unmodified lines
386367 if (rc)
387368 dev_err(rdev_to_dev(rdev),
388369 "Failed to free HW ring:%d :%#x", req.ring_id, rc);
389− if (do_unlock)
390− rtnl_unlock();
391370 return rc;
392371 }
393372
@@ -405,7 +384,6 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr, · 11 unmodified lines
405384 return rc;
406385
407386 memset(&fw_msg, 0, sizeof(fw_msg));
408− rtnl_lock();
409387 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_ALLOC, -1, -1);
410388 req.enables = 0;
411389 req.page_tbl_addr = cpu_to_le64(dma_arr[0]);
@@ -426,27 +404,21 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr, · 14 unmodified lines
426404 if (!rc)
427405 *fw_ring_id = le16_to_cpu(resp.ring_id);
428406
429− rtnl_unlock();
430407 return rc;
431408 }
432409
433410 static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
434− u32 fw_stats_ctx_id, bool lock_wait)
411+ u32 fw_stats_ctx_id)
435412 {
436413 struct bnxt_en_dev *en_dev = rdev->en_dev;
437414 struct hwrm_stat_ctx_free_input req = {0};
438415 struct bnxt_fw_msg fw_msg;
439− bool do_unlock = false;
440416 int rc = -EINVAL;
441417
442418 if (!en_dev)
443419 return rc;
444420
445421 memset(&fw_msg, 0, sizeof(fw_msg));
446− if (lock_wait) {
447− rtnl_lock();
448− do_unlock = true;
449− }
450422
451423 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1);
452424 req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id);
@@ -457,8 +429,6 @@ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev, · 4 unmodified lines
457429 dev_err(rdev_to_dev(rdev),
458430 "Failed to free HW stats context %#x", rc);
459431
460− if (do_unlock)
461− rtnl_unlock();
462432 return rc;
463433 }
464434
@@ -478,7 +448,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, · 13 unmodified lines
478448 return rc;
479449
480450 memset(&fw_msg, 0, sizeof(fw_msg));
481− rtnl_lock();
482451
483452 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1);
484453 req.update_period_ms = cpu_to_le32(1000);
@@ -490,7 +459,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, · 5 unmodified lines
490459 if (!rc)
491460 *fw_stats_ctx_id = le32_to_cpu(resp.stat_ctx_id);
492461
493− rtnl_unlock();
494462 return rc;
495463 }
496464
@@ -929,19 +897,19 @@ fail: · 432 unmodified lines
929897 return rc;
930898 }
931899
932−static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev, bool lock_wait)
900+static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev)
933901 {
934902 int i;
935903
936904 for (i = 0; i < rdev->num_msix - 1; i++) {
937− bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id, lock_wait);
905+ bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id);
938906 bnxt_qplib_free_nq(&rdev->nq[i]);
939907 }
940908 }
941909
942−static void bnxt_re_free_res(struct bnxt_re_dev *rdev, bool lock_wait)
910+static void bnxt_re_free_res(struct bnxt_re_dev *rdev)
943911 {
944− bnxt_re_free_nq_res(rdev, lock_wait);
912+ bnxt_re_free_nq_res(rdev);
945913
946914 if (rdev->qplib_res.dpi_tbl.max) {
947915 bnxt_qplib_dealloc_dpi(&rdev->qplib_res,
@@ -1219,7 +1187,7 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev) · 271 unmodified lines
12191187 return 0;
12201188 }
12211189
1222−static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)
1190+static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)
12231191 {
12241192 int i, rc;
12251193
@@ -1234,28 +1202,27 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait) · 8 unmodified lines
12341202 cancel_delayed_work(&rdev->worker);
12351203
12361204 bnxt_re_cleanup_res(rdev);
1237− bnxt_re_free_res(rdev, lock_wait);
1205+ bnxt_re_free_res(rdev);
12381206
12391207 if (test_and_clear_bit(BNXT_RE_FLAG_RCFW_CHANNEL_EN, &rdev->flags)) {
12401208 rc = bnxt_qplib_deinit_rcfw(&rdev->rcfw);
12411209 if (rc)
12421210 dev_warn(rdev_to_dev(rdev),
12431211 "Failed to deinitialize RCFW: %#x", rc);
1244− bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id,
1245− lock_wait);
1212+ bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id);
12461213 bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx);
12471214 bnxt_qplib_disable_rcfw_channel(&rdev->rcfw);
1248− bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, lock_wait);
1215+ bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id);
12491216 bnxt_qplib_free_rcfw_channel(&rdev->rcfw);
12501217 }
12511218 if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags)) {
1252− rc = bnxt_re_free_msix(rdev, lock_wait);
1219+ rc = bnxt_re_free_msix(rdev);
12531220 if (rc)
12541221 dev_warn(rdev_to_dev(rdev),
12551222 "Failed to free MSI-X vectors: %#x", rc);
12561223 }
12571224 if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags)) {
1258− rc = bnxt_re_unregister_netdev(rdev, lock_wait);
1225+ rc = bnxt_re_unregister_netdev(rdev);
12591226 if (rc)
12601227 dev_warn(rdev_to_dev(rdev),
12611228 "Failed to unregister with netdev: %#x", rc);
@@ -1276,6 +1243,12 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) · 14 unmodified lines
12761243 {
12771244 int i, j, rc;
12781245
1246+ bool locked;
1247+
1248+ /* Acquire rtnl lock through out this function */
1249+ rtnl_lock();
1250+ locked = true;
1251+
12791252 /* Registered a new RoCE device instance to netdev */
12801253 rc = bnxt_re_register_netdev(rdev);
12811254 if (rc) {
@@ -1374,12 +1347,16 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) · 92 unmodified lines
13741347 schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000));
13751348 }
13761349
1350+ rtnl_unlock();
1351+ locked = false;
1352+
13771353 /* Register ib dev */
13781354 rc = bnxt_re_register_ib(rdev);
13791355 if (rc) {
13801356 pr_err("Failed to register with IB: %#x\n", rc);
13811357 goto fail;
13821358 }
1359+ set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
13831360 dev_info(rdev_to_dev(rdev), "Device registered successfully");
13841361 for (i = 0; i < ARRAY_SIZE(bnxt_re_attributes); i++) {
13851362 rc = device_create_file(&rdev->ibdev.dev,
@@ -1395,7 +1372,6 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) · 9 unmodified lines
13951372 goto fail;
13961373 }
13971374 }
1398− set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags);
13991375 ib_get_eth_speed(&rdev->ibdev, 1, &rdev->active_speed,
14001376 &rdev->active_width);
14011377 set_bit(BNXT_RE_FLAG_ISSUE_ROCE_STATS, &rdev->flags);
@@ -1404,17 +1380,21 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) · 2 unmodified lines
14041380
14051381 return 0;
14061382 free_sctx:
1407− bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, true);
1383+ bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id);
14081384 free_ctx:
14091385 bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx);
14101386 disable_rcfw:
14111387 bnxt_qplib_disable_rcfw_channel(&rdev->rcfw);
14121388 free_ring:
1413− bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, true);
1389+ bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id);
14141390 free_rcfw:
14151391 bnxt_qplib_free_rcfw_channel(&rdev->rcfw);
14161392 fail:
1417− bnxt_re_ib_unreg(rdev, true);
1393+ if (!locked)
1394+ rtnl_lock();
1395+ bnxt_re_ib_unreg(rdev);
1396+ rtnl_unlock();
1397+
14181398 return rc;
14191399 }
14201400
@@ -1567,7 +1547,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier, · 146 unmodified lines
15671547 */
15681548 if (atomic_read(&rdev->sched_count) > 0)
15691549 goto exit;
1570− bnxt_re_ib_unreg(rdev, false);
1550+ bnxt_re_ib_unreg(rdev);
15711551 bnxt_re_remove_one(rdev);
15721552 bnxt_re_dev_unreg(rdev);
15731553 break;
@@ -1646,7 +1626,10 @@ static void __exit bnxt_re_mod_exit(void) · 72 unmodified lines
16461626 */
16471627 flush_workqueue(bnxt_re_wq);
16481628 bnxt_re_dev_stop(rdev);
1649− bnxt_re_ib_unreg(rdev, true);
1629+ /* Acquire the rtnl_lock as the L2 resources are freed here */
1630+ rtnl_lock();
1631+ bnxt_re_ib_unreg(rdev);
1632+ rtnl_unlock();
16501633 bnxt_re_remove_one(rdev);
16511634 bnxt_re_dev_unreg(rdev);
16521635 }
drivers/infiniband/hw/bnxt_re/qplib_fp.c+1−1
@@ -196,7 +196,7 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res, · 195 unmodified lines
196196 struct bnxt_qplib_qp *qp)
197197 {
198198 struct bnxt_qplib_q *rq = &qp->rq;
199− struct bnxt_qplib_q *sq = &qp->rq;
199+ struct bnxt_qplib_q *sq = &qp->sq;
200200 int rc = 0;
201201
202202 if (qp->sq_hdr_buf_size && sq->hwq.max_elements) {
drivers/infiniband/hw/cxgb4/qp.c+6−0
@@ -1685,6 +1685,12 @@ static void flush_qp(struct c4iw_qp *qhp) · 1684 unmodified lines
16851685 schp = to_c4iw_cq(qhp->ibqp.send_cq);
16861686
16871687 if (qhp->ibqp.uobject) {
1688+
1689+ /* for user qps, qhp->wq.flushed is protected by qhp->mutex */
1690+ if (qhp->wq.flushed)
1691+ return;
1692+
1693+ qhp->wq.flushed = 1;
16881694 t4_set_wq_in_error(&qhp->wq, 0);
16891695 t4_set_cq_in_error(&rchp->cq);
16901696 spin_lock_irqsave(&rchp->comp_handler_lock, flag);
drivers/infiniband/hw/hfi1/chip.c+5−1
@@ -6733,6 +6733,7 @@ void start_freeze_handling(struct hfi1_pportdata *ppd, int flags) · 6732 unmodified lines
67336733 struct hfi1_devdata *dd = ppd->dd;
67346734 struct send_context *sc;
67356735 int i;
6736+ int sc_flags;
67366737
67376738 if (flags & FREEZE_SELF)
67386739 write_csr(dd, CCE_CTRL, CCE_CTRL_SPC_FREEZE_SMASK);
@@ -6743,11 +6744,13 @@ void start_freeze_handling(struct hfi1_pportdata *ppd, int flags) · 4 unmodified lines
67436744 /* notify all SDMA engines that they are going into a freeze */
67446745 sdma_freeze_notify(dd, !!(flags & FREEZE_LINK_DOWN));
67456746
6747+ sc_flags = SCF_FROZEN | SCF_HALTED | (flags & FREEZE_LINK_DOWN ?
6748+ SCF_LINK_DOWN : 0);
67466749 /* do halt pre-handling on all enabled send contexts */
67476750 for (i = 0; i < dd->num_send_contexts; i++) {
67486751 sc = dd->send_contexts[i].sc;
67496752 if (sc && (sc->flags & SCF_ENABLED))
6750− sc_stop(sc, SCF_FROZEN | SCF_HALTED);
6753+ sc_stop(sc, sc_flags);
67516754 }
67526755
67536756 /* Send context are frozen. Notify user space */
@@ -10674,6 +10677,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state) · 3920 unmodified lines
1067410677 add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
1067510678
1067610679 handle_linkup_change(dd, 1);
10680+ pio_kernel_linkup(dd);
1067710681
1067810682 /*
1067910683 * After link up, a new link width will have been set.
drivers/infiniband/hw/hfi1/pcie.c+4−7
@@ -893,14 +893,11 @@ static int trigger_sbr(struct hfi1_devdata *dd) · 892 unmodified lines
893893 }
894894
895895 /*
896− * A secondary bus reset (SBR) issues a hot reset to our device.
897− * The following routine does a 1s wait after the reset is dropped
898− * per PCI Trhfa (recovery time). PCIe 3.0 section 6.6.1 -
899− * Conventional Reset, paragraph 3, line 35 also says that a 1s
900− * delay after a reset is required. Per spec requirements,
901− * the link is either working or not after that point.
896+ * This is an end around to do an SBR during probe time. A new API needs
897+ * to be implemented to have cleaner interface but this fixes the
898+ * current brokenness
902899 */
903− return pci_reset_bus(dev);
900+ return pci_bridge_secondary_bus_reset(dev->bus->self);
904901 }
905902
906903 /*
drivers/infiniband/hw/hfi1/pio.c+41−10
@@ -86,6 +86,7 @@ void pio_send_control(struct hfi1_devdata *dd, int op) · 85 unmodified lines
8686 unsigned long flags;
8787 int write = 1; /* write sendctrl back */
8888 int flush = 0; /* re-read sendctrl to make sure it is flushed */
89+ int i;
8990
9091 spin_lock_irqsave(&dd->sendctrl_lock, flags);
9192
@@ -95,9 +96,13 @@ void pio_send_control(struct hfi1_devdata *dd, int op) · 3 unmodified lines
9596 reg |= SEND_CTRL_SEND_ENABLE_SMASK;
9697 /* Fall through */
9798 case PSC_DATA_VL_ENABLE:
99+ mask = 0;
100+ for (i = 0; i < ARRAY_SIZE(dd->vld); i++)
101+ if (!dd->vld[i].mtu)
102+ mask |= BIT_ULL(i);
98103 /* Disallow sending on VLs not enabled */
99− mask = (((~0ull) << num_vls) & SEND_CTRL_UNSUPPORTED_VL_MASK) <<
100− SEND_CTRL_UNSUPPORTED_VL_SHIFT;
104+ mask = (mask & SEND_CTRL_UNSUPPORTED_VL_MASK) <<
105+ SEND_CTRL_UNSUPPORTED_VL_SHIFT;
101106 reg = (reg & ~SEND_CTRL_UNSUPPORTED_VL_SMASK) | mask;
102107 break;
103108 case PSC_GLOBAL_DISABLE:
@@ -921,20 +926,18 @@ void sc_free(struct send_context *sc) · 817 unmodified lines
921926 void sc_disable(struct send_context *sc)
922927 {
923928 u64 reg;
924− unsigned long flags;
925929 struct pio_buf *pbuf;
926930
927931 if (!sc)
928932 return;
929933
930934 /* do all steps, even if already disabled */
931− spin_lock_irqsave(&sc->alloc_lock, flags);
935+ spin_lock_irq(&sc->alloc_lock);
932936 reg = read_kctxt_csr(sc->dd, sc->hw_context, SC(CTRL));
933937 reg &= ~SC(CTRL_CTXT_ENABLE_SMASK);
934938 sc->flags &= ~SCF_ENABLED;
935939 sc_wait_for_packet_egress(sc, 1);
936940 write_kctxt_csr(sc->dd, sc->hw_context, SC(CTRL), reg);
937− spin_unlock_irqrestore(&sc->alloc_lock, flags);
938941
939942 /*
940943 * Flush any waiters. Once the context is disabled,
@@ -944,7 +947,7 @@ void sc_disable(struct send_context *sc) · 3 unmodified lines
944947 * proceed with the flush.
945948 */
946949 udelay(1);
947− spin_lock_irqsave(&sc->release_lock, flags);
950+ spin_lock(&sc->release_lock);
948951 if (sc->sr) { /* this context has a shadow ring */
949952 while (sc->sr_tail != sc->sr_head) {
950953 pbuf = &sc->sr[sc->sr_tail].pbuf;
@@ -955,7 +958,8 @@ void sc_disable(struct send_context *sc) · 4 unmodified lines
955958 sc->sr_tail = 0;
956959 }
957960 }
958− spin_unlock_irqrestore(&sc->release_lock, flags);
961+ spin_unlock(&sc->release_lock);
962+ spin_unlock_irq(&sc->alloc_lock);
959963 }
960964
961965 /* return SendEgressCtxtStatus.PacketOccupancy */
@@ -1178,11 +1182,39 @@ void pio_kernel_unfreeze(struct hfi1_devdata *dd) · 216 unmodified lines
11781182 sc = dd->send_contexts[i].sc;
11791183 if (!sc || !(sc->flags & SCF_FROZEN) || sc->type == SC_USER)
11801184 continue;
1185+ if (sc->flags & SCF_LINK_DOWN)
1186+ continue;
11811187
11821188 sc_enable(sc); /* will clear the sc frozen flag */
11831189 }
11841190 }
11851191
1192+/**
1193+ * pio_kernel_linkup() - Re-enable send contexts after linkup event
1194+ * @dd: valid devive data
1195+ *
1196+ * When the link goes down, the freeze path is taken. However, a link down
1197+ * event is different from a freeze because if the send context is re-enabled
1198+ * whowever is sending data will start sending data again, which will hang
1199+ * any QP that is sending data.
1200+ *
1201+ * The freeze path now looks at the type of event that occurs and takes this
1202+ * path for link down event.
1203+ */
1204+void pio_kernel_linkup(struct hfi1_devdata *dd)
1205+{
1206+ struct send_context *sc;
1207+ int i;
1208+
1209+ for (i = 0; i < dd->num_send_contexts; i++) {
1210+ sc = dd->send_contexts[i].sc;
1211+ if (!sc || !(sc->flags & SCF_LINK_DOWN) || sc->type == SC_USER)
1212+ continue;
1213+
1214+ sc_enable(sc); /* will clear the sc link down flag */
1215+ }
1216+}
1217+
11861218 /*
11871219 * Wait for the SendPioInitCtxt.PioInitInProgress bit to clear.
11881220 * Returns:
@@ -1382,11 +1414,10 @@ void sc_stop(struct send_context *sc, int flag) · 193 unmodified lines
13821414 {
13831415 unsigned long flags;
13841416
1385− /* mark the context */
1386− sc->flags |= flag;
1387−
13881417 /* stop buffer allocations */
13891418 spin_lock_irqsave(&sc->alloc_lock, flags);
1419+ /* mark the context */
1420+ sc->flags |= flag;
13901421 sc->flags &= ~SCF_ENABLED;
13911422 spin_unlock_irqrestore(&sc->alloc_lock, flags);
13921423 wake_up(&sc->halt_wait);
drivers/infiniband/hw/hfi1/pio.h+2−0
@@ -139,6 +139,7 @@ struct send_context { · 138 unmodified lines
139139 #define SCF_IN_FREE 0x02
140140 #define SCF_HALTED 0x04
141141 #define SCF_FROZEN 0x08
142+#define SCF_LINK_DOWN 0x10
142143
143144 struct send_context_info {
144145 struct send_context *sc; /* allocated working context */
@@ -306,6 +307,7 @@ void set_pio_integrity(struct send_context *sc); · 161 unmodified lines
306307 void pio_reset_all(struct hfi1_devdata *dd);
307308 void pio_freeze(struct hfi1_devdata *dd);
308309 void pio_kernel_unfreeze(struct hfi1_devdata *dd);
310+void pio_kernel_linkup(struct hfi1_devdata *dd);
309311
310312 /* global PIO send control operations */
311313 #define PSC_GLOBAL_ENABLE 0
drivers/infiniband/hw/hfi1/user_sdma.c+1−1
@@ -828,7 +828,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) · 827 unmodified lines
828828 if (READ_ONCE(iovec->offset) == iovec->iov.iov_len) {
829829 if (++req->iov_idx == req->data_iovs) {
830830 ret = -EFAULT;
831− goto free_txreq;
831+ goto free_tx;
832832 }
833833 iovec = &req->iovs[req->iov_idx];
834834 WARN_ON(iovec->offset);
drivers/infiniband/hw/hfi1/verbs.c+7−1
@@ -1582,6 +1582,7 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr) · 1581 unmodified lines
15821582 struct hfi1_pportdata *ppd;
15831583 struct hfi1_devdata *dd;
15841584 u8 sc5;
1585+ u8 sl;
15851586
15861587 if (hfi1_check_mcast(rdma_ah_get_dlid(ah_attr)) &&
15871588 !(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH))
@@ -1590,8 +1591,13 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr) · 2 unmodified lines
15901591 /* test the mapping for validity */
15911592 ibp = to_iport(ibdev, rdma_ah_get_port_num(ah_attr));
15921593 ppd = ppd_from_ibp(ibp);
1593− sc5 = ibp->sl_to_sc[rdma_ah_get_sl(ah_attr)];
15941594 dd = dd_from_ppd(ppd);
1595+
1596+ sl = rdma_ah_get_sl(ah_attr);
1597+ if (sl >= ARRAY_SIZE(ibp->sl_to_sc))
1598+ return -EINVAL;
1599+
1600+ sc5 = ibp->sl_to_sc[sl];
15951601 if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf)
15961602 return -EINVAL;
15971603 return 0;
drivers/infiniband/hw/mlx4/main.c+5−3
@@ -517,9 +517,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 516 unmodified lines
517517 props->page_size_cap = dev->dev->caps.page_size_cap;
518518 props->max_qp = dev->dev->quotas.qp;
519519 props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
520− props->max_send_sge = dev->dev->caps.max_sq_sg;
521− props->max_recv_sge = dev->dev->caps.max_rq_sg;
522− props->max_sge_rd = MLX4_MAX_SGE_RD;
520+ props->max_send_sge =
521+ min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
522+ props->max_recv_sge =
523+ min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
524+ props->max_sge_rd = MLX4_MAX_SGE_RD;
523525 props->max_cq = dev->dev->quotas.cq;
524526 props->max_cqe = dev->dev->caps.max_cqes;
525527 props->max_mr = dev->dev->quotas.mpt;
drivers/infiniband/hw/mlx5/devx.c+4−1
@@ -723,6 +723,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)( · 722 unmodified lines
723723 attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE);
724724 struct mlx5_ib_ucontext *c = to_mucontext(uobj->context);
725725 struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
726+ u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
726727 struct devx_obj *obj;
727728 int err;
728729
@@ -754,10 +755,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)( · 25 unmodified lines
754755
755756 err = uverbs_copy_to(attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, cmd_out, cmd_out_len);
756757 if (err)
757− goto obj_free;
758+ goto obj_destroy;
758759
759760 return 0;
760761
762+obj_destroy:
763+ mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
761764 obj_free:
762765 kfree(obj);
763766 return err;
drivers/infiniband/ulp/ipoib/ipoib_cm.c+2−0
@@ -1027,12 +1027,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, · 1026 unmodified lines
10271027
10281028 skb_queue_head_init(&skqueue);
10291029
1030+ netif_tx_lock_bh(p->dev);
10301031 spin_lock_irq(&priv->lock);
10311032 set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
10321033 if (p->neigh)
10331034 while ((skb = __skb_dequeue(&p->neigh->queue)))
10341035 __skb_queue_tail(&skqueue, skb);
10351036 spin_unlock_irq(&priv->lock);
1037+ netif_tx_unlock_bh(p->dev);
10361038
10371039 while ((skb = __skb_dequeue(&skqueue))) {
10381040 skb->dev = p->dev;
drivers/infiniband/ulp/srp/ib_srp.c+3−3
@@ -2951,7 +2951,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) · 2950 unmodified lines
29512951 {
29522952 struct srp_target_port *target = host_to_target(scmnd->device->host);
29532953 struct srp_rdma_ch *ch;
2954− int i;
2954+ int i, j;
29552955 u8 status;
29562956
29572957 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
@@ -2965,8 +2965,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) · 7 unmodified lines
29652965
29662966 for (i = 0; i < target->ch_count; i++) {
29672967 ch = &target->ch[i];
2968− for (i = 0; i < target->req_ring_size; ++i) {
2969− struct srp_request *req = &ch->req_ring[i];
2968+ for (j = 0; j < target->req_ring_size; ++j) {
2969+ struct srp_request *req = &ch->req_ring[j];
29702970
29712971 srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
29722972 }
drivers/input/keyboard/atakbd.c+28−46
@@ -75,8 +75,7 @@ MODULE_LICENSE("GPL"); · 74 unmodified lines
7575 */
7676
7777
78−static unsigned char atakbd_keycode[0x72] = { /* American layout */
79− [0] = KEY_GRAVE,
78+static unsigned char atakbd_keycode[0x73] = { /* American layout */
8079 [1] = KEY_ESC,
8180 [2] = KEY_1,
8281 [3] = KEY_2,
@@ -117,9 +116,9 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */ · 34 unmodified lines
117116 [38] = KEY_L,
118117 [39] = KEY_SEMICOLON,
119118 [40] = KEY_APOSTROPHE,
120− [41] = KEY_BACKSLASH, /* FIXME, '#' */
119+ [41] = KEY_GRAVE,
121120 [42] = KEY_LEFTSHIFT,
122− [43] = KEY_GRAVE, /* FIXME: '~' */
121+ [43] = KEY_BACKSLASH,
123122 [44] = KEY_Z,
124123 [45] = KEY_X,
125124 [46] = KEY_C,
@@ -145,45 +144,34 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */ · 19 unmodified lines
145144 [66] = KEY_F8,
146145 [67] = KEY_F9,
147146 [68] = KEY_F10,
148− [69] = KEY_ESC,
149− [70] = KEY_DELETE,
150− [71] = KEY_KP7,
151− [72] = KEY_KP8,
152− [73] = KEY_KP9,
147+ [71] = KEY_HOME,
148+ [72] = KEY_UP,
153149 [74] = KEY_KPMINUS,
154− [75] = KEY_KP4,
155− [76] = KEY_KP5,
156− [77] = KEY_KP6,
150+ [75] = KEY_LEFT,
151+ [77] = KEY_RIGHT,
157152 [78] = KEY_KPPLUS,
158− [79] = KEY_KP1,
159− [80] = KEY_KP2,
160− [81] = KEY_KP3,
161− [82] = KEY_KP0,
162− [83] = KEY_KPDOT,
163− [90] = KEY_KPLEFTPAREN,
164− [91] = KEY_KPRIGHTPAREN,
165− [92] = KEY_KPASTERISK, /* FIXME */
166− [93] = KEY_KPASTERISK,
167− [94] = KEY_KPPLUS,
168− [95] = KEY_HELP,
153+ [80] = KEY_DOWN,
154+ [82] = KEY_INSERT,
155+ [83] = KEY_DELETE,
169156 [96] = KEY_102ND,
170− [97] = KEY_KPASTERISK, /* FIXME */
171− [98] = KEY_KPSLASH,
157+ [97] = KEY_UNDO,
158+ [98] = KEY_HELP,
172159 [99] = KEY_KPLEFTPAREN,
173160 [100] = KEY_KPRIGHTPAREN,
174161 [101] = KEY_KPSLASH,
175162 [102] = KEY_KPASTERISK,
176− [103] = KEY_UP,
177− [104] = KEY_KPASTERISK, /* FIXME */
178− [105] = KEY_LEFT,
179− [106] = KEY_RIGHT,
180− [107] = KEY_KPASTERISK, /* FIXME */
181− [108] = KEY_DOWN,
182− [109] = KEY_KPASTERISK, /* FIXME */
183− [110] = KEY_KPASTERISK, /* FIXME */
184− [111] = KEY_KPASTERISK, /* FIXME */
185− [112] = KEY_KPASTERISK, /* FIXME */
186− [113] = KEY_KPASTERISK /* FIXME */
163+ [103] = KEY_KP7,
164+ [104] = KEY_KP8,
165+ [105] = KEY_KP9,
166+ [106] = KEY_KP4,
167+ [107] = KEY_KP5,
168+ [108] = KEY_KP6,
169+ [109] = KEY_KP1,
170+ [110] = KEY_KP2,
171+ [111] = KEY_KP3,
172+ [112] = KEY_KP0,
173+ [113] = KEY_KPDOT,
174+ [114] = KEY_KPENTER,
187175 };
188176
189177 static struct input_dev *atakbd_dev;
@@ -191,21 +179,15 @@ static struct input_dev *atakbd_dev; · 1 unmodified line
191179 static void atakbd_interrupt(unsigned char scancode, char down)
192180 {
193181
194− if (scancode < 0x72) { /* scancodes < 0xf2 are keys */
182+ if (scancode < 0x73) { /* scancodes < 0xf3 are keys */
195183
196184 // report raw events here?
197185
198186 scancode = atakbd_keycode[scancode];
199187
200− if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
201− input_report_key(atakbd_dev, scancode, 1);
202− input_report_key(atakbd_dev, scancode, 0);
203− input_sync(atakbd_dev);
204− } else {
205− input_report_key(atakbd_dev, scancode, down);
206− input_sync(atakbd_dev);
207− }
208− } else /* scancodes >= 0xf2 are mouse data, most likely */
188+ input_report_key(atakbd_dev, scancode, down);
189+ input_sync(atakbd_dev);
190+ } else /* scancodes >= 0xf3 are mouse data, most likely */
209191 printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
210192
211193 return;
drivers/input/misc/uinput.c+1−1
@@ -410,7 +410,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, · 409 unmodified lines
410410 min = abs->minimum;
411411 max = abs->maximum;
412412
413− if ((min != 0 || max != 0) && max <= min) {
413+ if ((min != 0 || max != 0) && max < min) {
414414 printk(KERN_DEBUG
415415 "%s: invalid abs[%02x] min:%d max:%d\n",
416416 UINPUT_NAME, code, min, max);
drivers/input/mouse/elantech.c+2−0
@@ -1178,6 +1178,8 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = { · 1177 unmodified lines
11781178 static const char * const middle_button_pnp_ids[] = {
11791179 "LEN2131", /* ThinkPad P52 w/ NFC */
11801180 "LEN2132", /* ThinkPad P52 */
1181+ "LEN2133", /* ThinkPad P72 w/ NFC */
1182+ "LEN2134", /* ThinkPad P72 */
11811183 NULL
11821184 };
11831185
drivers/input/touchscreen/egalax_ts.c+6−0
@@ -241,6 +241,9 @@ static int __maybe_unused egalax_ts_suspend(struct device *dev) · 240 unmodified lines
241241 struct i2c_client *client = to_i2c_client(dev);
242242 int ret;
243243
244+ if (device_may_wakeup(dev))
245+ return enable_irq_wake(client->irq);
246+
244247 ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN);
245248 return ret > 0 ? 0 : ret;
246249 }
@@ -249,6 +252,9 @@ static int __maybe_unused egalax_ts_resume(struct device *dev) · 2 unmodified lines
249252 {
250253 struct i2c_client *client = to_i2c_client(dev);
251254
255+ if (device_may_wakeup(dev))
256+ return disable_irq_wake(client->irq);
257+
252258 return egalax_wake_up_device(client);
253259 }
254260
drivers/iommu/amd_iommu.c+6−0
@@ -246,7 +246,13 @@ static u16 get_alias(struct device *dev) · 245 unmodified lines
246246
247247 /* The callers make sure that get_device_id() does not fail here */
248248 devid = get_device_id(dev);
249+
250+ /* For ACPI HID devices, we simply return the devid as such */
251+ if (!dev_is_pci(dev))
252+ return devid;
253+
249254 ivrs_alias = amd_iommu_alias_table[devid];
255+
250256 pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
251257
252258 if (ivrs_alias == pci_alias)
drivers/iommu/intel-iommu.c+3−3
@@ -2540,9 +2540,9 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 2539 unmodified lines
25402540 if (dev && dev_is_pci(dev) && info->pasid_supported) {
25412541 ret = intel_pasid_alloc_table(dev);
25422542 if (ret) {
2543− __dmar_remove_one_dev_info(info);
2544− spin_unlock_irqrestore(&device_domain_lock, flags);
2545− return NULL;
2543+ pr_warn("No pasid table for %s, pasid disabled\n",
2544+ dev_name(dev));
2545+ info->pasid_supported = 0;
25462546 }
25472547 }
25482548 spin_unlock_irqrestore(&device_domain_lock, flags);
drivers/iommu/intel-pasid.h+1−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111 #define __INTEL_PASID_H
1212
1313 #define PASID_MIN 0x1
14−#define PASID_MAX 0x100000
14+#define PASID_MAX 0x20000
1515
1616 struct pasid_entry {
1717 u64 val;
drivers/iommu/rockchip-iommu.c+6−0
@@ -1241,6 +1241,12 @@ err_unprepare_clocks: · 1240 unmodified lines
12411241
12421242 static void rk_iommu_shutdown(struct platform_device *pdev)
12431243 {
1244+ struct rk_iommu *iommu = platform_get_drvdata(pdev);
1245+ int i = 0, irq;
1246+
1247+ while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
1248+ devm_free_irq(iommu->dev, irq, iommu);
1249+
12441250 pm_runtime_force_suspend(&pdev->dev);
12451251 }
12461252
drivers/irqchip/irq-gic-v3-its.c+3−1
@@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = { · 1438 unmodified lines
14391439 * The consequence of the above is that allocation is cost is low, but
14401440 * freeing is expensive. We assumes that freeing rarely occurs.
14411441 */
1442+#define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */
14421443
14431444 static DEFINE_MUTEX(lpi_range_lock);
14441445 static LIST_HEAD(lpi_range_list);
@@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void) · 180 unmodified lines
16251626 {
16261627 phys_addr_t paddr;
16271628
1628− lpi_id_bits = GICD_TYPER_ID_BITS(gic_rdists->gicd_typer);
1629+ lpi_id_bits = min_t(u32, GICD_TYPER_ID_BITS(gic_rdists->gicd_typer),
1630+ ITS_MAX_LPI_NRBITS);
16291631 gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT);
16301632 if (!gic_rdists->prop_page) {
16311633 pr_err("Failed to allocate PROPBASE\n");
drivers/md/bcache/bcache.h+1−0
@@ -965,6 +965,7 @@ void bch_prio_write(struct cache *ca); · 964 unmodified lines
965965 void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent);
966966
967967 extern struct workqueue_struct *bcache_wq;
968+extern struct workqueue_struct *bch_journal_wq;
968969 extern struct mutex bch_register_lock;
969970 extern struct list_head bch_cache_sets;
970971
drivers/md/bcache/journal.c+3−3
@@ -485,7 +485,7 @@ static void do_journal_discard(struct cache *ca) · 484 unmodified lines
485485
486486 closure_get(&ca->set->cl);
487487 INIT_WORK(&ja->discard_work, journal_discard_work);
488− schedule_work(&ja->discard_work);
488+ queue_work(bch_journal_wq, &ja->discard_work);
489489 }
490490 }
491491
@@ -592,7 +592,7 @@ static void journal_write_done(struct closure *cl) · 100 unmodified lines
592592 : &j->w[0];
593593
594594 __closure_wake_up(&w->wait);
595− continue_at_nobarrier(cl, journal_write, system_wq);
595+ continue_at_nobarrier(cl, journal_write, bch_journal_wq);
596596 }
597597
598598 static void journal_write_unlock(struct closure *cl)
@@ -627,7 +627,7 @@ static void journal_write_unlocked(struct closure *cl) · 28 unmodified lines
627627 spin_unlock(&c->journal.lock);
628628
629629 btree_flush_write(c);
630− continue_at(cl, journal_write, system_wq);
630+ continue_at(cl, journal_write, bch_journal_wq);
631631 return;
632632 }
633633
drivers/md/bcache/super.c+8−0
@@ -47,6 +47,7 @@ static int bcache_major; · 46 unmodified lines
4747 static DEFINE_IDA(bcache_device_idx);
4848 static wait_queue_head_t unregister_wait;
4949 struct workqueue_struct *bcache_wq;
50+struct workqueue_struct *bch_journal_wq;
5051
5152 #define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
5253 /* limitation of partitions number on single bcache device */
@@ -2341,6 +2342,9 @@ static void bcache_exit(void) · 2288 unmodified lines
23412342 kobject_put(bcache_kobj);
23422343 if (bcache_wq)
23432344 destroy_workqueue(bcache_wq);
2345+ if (bch_journal_wq)
2346+ destroy_workqueue(bch_journal_wq);
2347+
23442348 if (bcache_major)
23452349 unregister_blkdev(bcache_major, "bcache");
23462350 unregister_reboot_notifier(&reboot);
@@ -2370,6 +2374,10 @@ static int __init bcache_init(void) · 23 unmodified lines
23702374 if (!bcache_wq)
23712375 goto err;
23722376
2377+ bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0);
2378+ if (!bch_journal_wq)
2379+ goto err;
2380+
23732381 bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
23742382 if (!bcache_kobj)
23752383 goto err;
drivers/md/dm-crypt.c+5−5
@@ -332,7 +332,7 @@ static int crypt_iv_essiv_init(struct crypt_config *cc) · 331 unmodified lines
332332 int err;
333333
334334 desc->tfm = essiv->hash_tfm;
335− desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
335+ desc->flags = 0;
336336
337337 err = crypto_shash_digest(desc, cc->key, cc->key_size, essiv->salt);
338338 shash_desc_zero(desc);
@@ -606,7 +606,7 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv, · 267 unmodified lines
606606 int i, r;
607607
608608 desc->tfm = lmk->hash_tfm;
609− desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
609+ desc->flags = 0;
610610
611611 r = crypto_shash_init(desc);
612612 if (r)
@@ -768,7 +768,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc, · 155 unmodified lines
768768
769769 /* calculate crc32 for every 32bit part and xor it */
770770 desc->tfm = tcw->crc32_tfm;
771− desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
771+ desc->flags = 0;
772772 for (i = 0; i < 4; i++) {
773773 r = crypto_shash_init(desc);
774774 if (r)
@@ -1251,7 +1251,7 @@ static void crypt_alloc_req_skcipher(struct crypt_config *cc, · 476 unmodified lines
12511251 * requests if driver request queue is full.
12521252 */
12531253 skcipher_request_set_callback(ctx->r.req,
1254− CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
1254+ CRYPTO_TFM_REQ_MAY_BACKLOG,
12551255 kcryptd_async_done, dmreq_of_req(cc, ctx->r.req));
12561256 }
12571257
@@ -1268,7 +1268,7 @@ static void crypt_alloc_req_aead(struct crypt_config *cc, · 10 unmodified lines
12681268 * requests if driver request queue is full.
12691269 */
12701270 aead_request_set_callback(ctx->r.req_aead,
1271− CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
1271+ CRYPTO_TFM_REQ_MAY_BACKLOG,
12721272 kcryptd_async_done, dmreq_of_req(cc, ctx->r.req_aead));
12731273 }
12741274
drivers/md/dm-integrity.c+2−2
@@ -532,7 +532,7 @@ static void section_mac(struct dm_integrity_c *ic, unsigned section, __u8 result · 531 unmodified lines
532532 unsigned j, size;
533533
534534 desc->tfm = ic->journal_mac;
535− desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
535+ desc->flags = 0;
536536
537537 r = crypto_shash_init(desc);
538538 if (unlikely(r)) {
@@ -676,7 +676,7 @@ static void complete_journal_encrypt(struct crypto_async_request *req, int err) · 137 unmodified lines
676676 static bool do_crypt(bool encrypt, struct skcipher_request *req, struct journal_completion *comp)
677677 {
678678 int r;
679− skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
679+ skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
680680 complete_journal_encrypt, comp);
681681 if (likely(encrypt))
682682 r = crypto_skcipher_encrypt(req);
drivers/md/dm-raid.c+61−93
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 2010-2011 Neil Brown
3− * Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved.
3+ * Copyright (C) 2010-2018 Red Hat, Inc. All rights reserved.
44 *
55 * This file is released under the GPL.
66 */
@@ -29,9 +29,6 @@ · 22 unmodified lines
2929 */
3030 #define MIN_RAID456_JOURNAL_SPACE (4*2048)
3131
32−/* Global list of all raid sets */
33−static LIST_HEAD(raid_sets);
34−
3532 static bool devices_handle_discard_safely = false;
3633
3734 /*
@@ -227,7 +224,6 @@ struct rs_layout { · 189 unmodified lines
227224
228225 struct raid_set {
229226 struct dm_target *ti;
230− struct list_head list;
231227
232228 uint32_t stripe_cache_entries;
233229 unsigned long ctr_flags;
@@ -273,19 +269,6 @@ static void rs_config_restore(struct raid_set *rs, struct rs_layout *l) · 39 unmodified lines
273269 mddev->new_chunk_sectors = l->new_chunk_sectors;
274270 }
275271
276−/* Find any raid_set in active slot for @rs on global list */
277−static struct raid_set *rs_find_active(struct raid_set *rs)
278−{
279− struct raid_set *r;
280− struct mapped_device *md = dm_table_get_md(rs->ti->table);
281−
282− list_for_each_entry(r, &raid_sets, list)
283− if (r != rs && dm_table_get_md(r->ti->table) == md)
284− return r;
285−
286− return NULL;
287−}
288−
289272 /* raid10 algorithms (i.e. formats) */
290273 #define ALGORITHM_RAID10_DEFAULT 0
291274 #define ALGORITHM_RAID10_NEAR 1
@@ -764,7 +747,6 @@ static struct raid_set *raid_set_alloc(struct dm_target *ti, struct raid_type *r · 472 unmodified lines
764747
765748 mddev_init(&rs->md);
766749
767− INIT_LIST_HEAD(&rs->list);
768750 rs->raid_disks = raid_devs;
769751 rs->delta_disks = 0;
770752
@@ -782,9 +764,6 @@ static struct raid_set *raid_set_alloc(struct dm_target *ti, struct raid_type *r · 11 unmodified lines
782764 for (i = 0; i < raid_devs; i++)
783765 md_rdev_init(&rs->dev[i].rdev);
784766
785− /* Add @rs to global list. */
786− list_add(&rs->list, &raid_sets);
787−
788767 /*
789768 * Remaining items to be initialized by further RAID params:
790769 * rs->md.persistent
@@ -797,7 +776,7 @@ static struct raid_set *raid_set_alloc(struct dm_target *ti, struct raid_type *r · 6 unmodified lines
797776 return rs;
798777 }
799778
800−/* Free all @rs allocations and remove it from global list. */
779+/* Free all @rs allocations */
801780 static void raid_set_free(struct raid_set *rs)
802781 {
803782 int i;
@@ -815,8 +794,6 @@ static void raid_set_free(struct raid_set *rs) · 11 unmodified lines
815794 dm_put_device(rs->ti, rs->dev[i].data_dev);
816795 }
817796
818− list_del(&rs->list);
819−
820797 kfree(rs);
821798 }
822799
@@ -2649,7 +2626,7 @@ static int rs_adjust_data_offsets(struct raid_set *rs) · 1826 unmodified lines
26492626 return 0;
26502627 }
26512628
2652− /* HM FIXME: get InSync raid_dev? */
2629+ /* HM FIXME: get In_Sync raid_dev? */
26532630 rdev = &rs->dev[0].rdev;
26542631
26552632 if (rs->delta_disks < 0) {
@@ -3149,6 +3126,11 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 493 unmodified lines
31493126 set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
31503127 rs_set_new(rs);
31513128 } else if (rs_is_recovering(rs)) {
3129+ /* Rebuild particular devices */
3130+ if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) {
3131+ set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
3132+ rs_setup_recovery(rs, MaxSector);
3133+ }
31523134 /* A recovering raid set may be resized */
31533135 ; /* skip setup rs */
31543136 } else if (rs_is_reshaping(rs)) {
@@ -3242,6 +3224,8 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 87 unmodified lines
32423224 /* Start raid set read-only and assumed clean to change in raid_resume() */
32433225 rs->md.ro = 1;
32443226 rs->md.in_sync = 1;
3227+
3228+ /* Keep array frozen */
32453229 set_bit(MD_RECOVERY_FROZEN, &rs->md.recovery);
32463230
32473231 /* Has to be held on running the array */
@@ -3265,7 +3249,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 17 unmodified lines
32653249 rs->callbacks.congested_fn = raid_is_congested;
32663250 dm_table_add_target_callbacks(ti->table, &rs->callbacks);
32673251
3268− /* If raid4/5/6 journal mode explictely requested (only possible with journal dev) -> set it */
3252+ /* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */
32693253 if (test_bit(__CTR_FLAG_JOURNAL_MODE, &rs->ctr_flags)) {
32703254 r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode);
32713255 if (r) {
@@ -3350,32 +3334,53 @@ static int raid_map(struct dm_target *ti, struct bio *bio) · 78 unmodified lines
33503334 return DM_MAPIO_SUBMITTED;
33513335 }
33523336
3353−/* Return string describing the current sync action of @mddev */
3354−static const char *decipher_sync_action(struct mddev *mddev, unsigned long recovery)
3337+/* Return sync state string for @state */
3338+enum sync_state { st_frozen, st_reshape, st_resync, st_check, st_repair, st_recover, st_idle };
3339+static const char *sync_str(enum sync_state state)
3340+{
3341+ /* Has to be in above sync_state order! */
3342+ static const char *sync_strs[] = {
3343+ "frozen",
3344+ "reshape",
3345+ "resync",
3346+ "check",
3347+ "repair",
3348+ "recover",
3349+ "idle"
3350+ };
3351+
3352+ return __within_range(state, 0, ARRAY_SIZE(sync_strs) - 1) ? sync_strs[state] : "undef";
3353+};
3354+
3355+/* Return enum sync_state for @mddev derived from @recovery flags */
3356+static const enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)
33553357 {
33563358 if (test_bit(MD_RECOVERY_FROZEN, &recovery))
3357− return "frozen";
3359+ return st_frozen;
33583360
3359− /* The MD sync thread can be done with io but still be running */
3361+ /* The MD sync thread can be done with io or be interrupted but still be running */
33603362 if (!test_bit(MD_RECOVERY_DONE, &recovery) &&
33613363 (test_bit(MD_RECOVERY_RUNNING, &recovery) ||
33623364 (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &recovery)))) {
33633365 if (test_bit(MD_RECOVERY_RESHAPE, &recovery))
3364− return "reshape";
3366+ return st_reshape;
33653367
33663368 if (test_bit(MD_RECOVERY_SYNC, &recovery)) {
33673369 if (!test_bit(MD_RECOVERY_REQUESTED, &recovery))
3368− return "resync";
3369− else if (test_bit(MD_RECOVERY_CHECK, &recovery))
3370− return "check";
3371− return "repair";
3370+ return st_resync;
3371+ if (test_bit(MD_RECOVERY_CHECK, &recovery))
3372+ return st_check;
3373+ return st_repair;
33723374 }
33733375
33743376 if (test_bit(MD_RECOVERY_RECOVER, &recovery))
3375− return "recover";
3377+ return st_recover;
3378+
3379+ if (mddev->reshape_position != MaxSector)
3380+ return st_reshape;
33763381 }
33773382
3378− return "idle";
3383+ return st_idle;
33793384 }
33803385
33813386 /*
@@ -3409,6 +3414,7 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery, · 27 unmodified lines
34093414 sector_t resync_max_sectors)
34103415 {
34113416 sector_t r;
3417+ enum sync_state state;
34123418 struct mddev *mddev = &rs->md;
34133419
34143420 clear_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);
@@ -3419,20 +3425,14 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery, · 4 unmodified lines
34193425 set_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);
34203426
34213427 } else {
3422− if (!test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags) &&
3423− !test_bit(MD_RECOVERY_INTR, &recovery) &&
3424− (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
3425− test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
3426− test_bit(MD_RECOVERY_RUNNING, &recovery)))
3427− r = mddev->curr_resync_completed;
3428− else
3428+ state = decipher_sync_action(mddev, recovery);
3429+
3430+ if (state == st_idle && !test_bit(MD_RECOVERY_INTR, &recovery))
34293431 r = mddev->recovery_cp;
3432+ else
3433+ r = mddev->curr_resync_completed;
34303434
3431− if (r >= resync_max_sectors &&
3432− (!test_bit(MD_RECOVERY_REQUESTED, &recovery) ||
3433− (!test_bit(MD_RECOVERY_FROZEN, &recovery) &&
3434− !test_bit(MD_RECOVERY_NEEDED, &recovery) &&
3435− !test_bit(MD_RECOVERY_RUNNING, &recovery)))) {
3435+ if (state == st_idle && r >= resync_max_sectors) {
34363436 /*
34373437 * Sync complete.
34383438 */
@@ -3440,24 +3440,20 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery, · 1 unmodified line
34403440 if (test_bit(MD_RECOVERY_RECOVER, &recovery))
34413441 set_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);
34423442
3443− } else if (test_bit(MD_RECOVERY_RECOVER, &recovery)) {
3443+ } else if (state == st_recover)
34443444 /*
34453445 * In case we are recovering, the array is not in sync
34463446 * and health chars should show the recovering legs.
34473447 */
34483448 ;
3449−
3450− } else if (test_bit(MD_RECOVERY_SYNC, &recovery) &&
3451− !test_bit(MD_RECOVERY_REQUESTED, &recovery)) {
3449+ else if (state == st_resync)
34523450 /*
34533451 * If "resync" is occurring, the raid set
34543452 * is or may be out of sync hence the health
34553453 * characters shall be 'a'.
34563454 */
34573455 set_bit(RT_FLAG_RS_RESYNCING, &rs->runtime_flags);
3458−
3459− } else if (test_bit(MD_RECOVERY_RESHAPE, &recovery) &&
3460− !test_bit(MD_RECOVERY_REQUESTED, &recovery)) {
3456+ else if (state == st_reshape)
34613457 /*
34623458 * If "reshape" is occurring, the raid set
34633459 * is or may be out of sync hence the health
@@ -3465,7 +3461,7 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery, · 1 unmodified line
34653461 */
34663462 set_bit(RT_FLAG_RS_RESYNCING, &rs->runtime_flags);
34673463
3468− } else if (test_bit(MD_RECOVERY_REQUESTED, &recovery)) {
3464+ else if (state == st_check || state == st_repair)
34693465 /*
34703466 * If "check" or "repair" is occurring, the raid set has
34713467 * undergone an initial sync and the health characters
@@ -3473,12 +3469,12 @@ static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery, · 1 unmodified line
34733469 */
34743470 set_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);
34753471
3476− } else {
3472+ else {
34773473 struct md_rdev *rdev;
34783474
34793475 /*
34803476 * We are idle and recovery is needed, prevent 'A' chars race
3481− * caused by components still set to in-sync by constrcuctor.
3477+ * caused by components still set to in-sync by constructor.
34823478 */
34833479 if (test_bit(MD_RECOVERY_NEEDED, &recovery))
34843480 set_bit(RT_FLAG_RS_RESYNCING, &rs->runtime_flags);
@@ -3542,7 +3538,7 @@ static void raid_status(struct dm_target *ti, status_type_t type, · 57 unmodified lines
35423538 progress = rs_get_progress(rs, recovery, resync_max_sectors);
35433539 resync_mismatches = (mddev->last_sync_action && !strcasecmp(mddev->last_sync_action, "check")) ?
35443540 atomic64_read(&mddev->resync_mismatches) : 0;
3545− sync_action = decipher_sync_action(&rs->md, recovery);
3541+ sync_action = sync_str(decipher_sync_action(&rs->md, recovery));
35463542
35473543 /* HM FIXME: do we want another state char for raid0? It shows 'D'/'A'/'-' now */
35483544 for (i = 0; i < rs->raid_disks; i++)
@@ -3892,14 +3888,13 @@ static int rs_start_reshape(struct raid_set *rs) · 343 unmodified lines
38923888 struct mddev *mddev = &rs->md;
38933889 struct md_personality *pers = mddev->pers;
38943890
3891+ /* Don't allow the sync thread to work until the table gets reloaded. */
3892+ set_bit(MD_RECOVERY_WAIT, &mddev->recovery);
3893+
38953894 r = rs_setup_reshape(rs);
38963895 if (r)
38973896 return r;
38983897
3899− /* Need to be resumed to be able to start reshape, recovery is frozen until raid_resume() though */
3900− if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
3901− mddev_resume(mddev);
3902−
39033898 /*
39043899 * Check any reshape constraints enforced by the personalility
39053900 *
@@ -3923,10 +3918,6 @@ static int rs_start_reshape(struct raid_set *rs) · 17 unmodified lines
39233918 }
39243919 }
39253920
3926− /* Suspend because a resume will happen in raid_resume() */
3927− set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags);
3928− mddev_suspend(mddev);
3929−
39303921 /*
39313922 * Now reshape got set up, update superblocks to
39323923 * reflect the fact so that a table reload will
@@ -3947,29 +3938,6 @@ static int raid_preresume(struct dm_target *ti) · 14 unmodified lines
39473938 if (test_and_set_bit(RT_FLAG_RS_PRERESUMED, &rs->runtime_flags))
39483939 return 0;
39493940
3950− if (!test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) {
3951− struct raid_set *rs_active = rs_find_active(rs);
3952−
3953− if (rs_active) {
3954− /*
3955− * In case no rebuilds have been requested
3956− * and an active table slot exists, copy
3957− * current resynchonization completed and
3958− * reshape position pointers across from
3959− * suspended raid set in the active slot.
3960− *
3961− * This resumes the new mapping at current
3962− * offsets to continue recover/reshape without
3963− * necessarily redoing a raid set partially or
3964− * causing data corruption in case of a reshape.
3965− */
3966− if (rs_active->md.curr_resync_completed != MaxSector)
3967− mddev->curr_resync_completed = rs_active->md.curr_resync_completed;
3968− if (rs_active->md.reshape_position != MaxSector)
3969− mddev->reshape_position = rs_active->md.reshape_position;
3970− }
3971− }
3972−
39733941 /*
39743942 * The superblocks need to be updated on disk if the
39753943 * array is new or new devices got added (thus zeroed
@@ -4046,7 +4014,7 @@ static void raid_resume(struct dm_target *ti) · 70 unmodified lines
40464014
40474015 static struct target_type raid_target = {
40484016 .name = "raid",
4049− .version = {1, 13, 2},
4017+ .version = {1, 14, 0},
40504018 .module = THIS_MODULE,
40514019 .ctr = raid_ctr,
40524020 .dtr = raid_dtr,
drivers/md/dm-thin-metadata.c+35−1
@@ -188,6 +188,12 @@ struct dm_pool_metadata { · 187 unmodified lines
188188 unsigned long flags;
189189 sector_t data_block_size;
190190
191+ /*
192+ * We reserve a section of the metadata for commit overhead.
193+ * All reported space does *not* include this.
194+ */
195+ dm_block_t metadata_reserve;
196+
191197 /*
192198 * Set if a transaction has to be aborted but the attempt to roll back
193199 * to the previous (good) transaction failed. The only pool metadata
@@ -816,6 +822,22 @@ static int __commit_transaction(struct dm_pool_metadata *pmd) · 622 unmodified lines
816822 return dm_tm_commit(pmd->tm, sblock);
817823 }
818824
825+static void __set_metadata_reserve(struct dm_pool_metadata *pmd)
826+{
827+ int r;
828+ dm_block_t total;
829+ dm_block_t max_blocks = 4096; /* 16M */
830+
831+ r = dm_sm_get_nr_blocks(pmd->metadata_sm, &total);
832+ if (r) {
833+ DMERR("could not get size of metadata device");
834+ pmd->metadata_reserve = max_blocks;
835+ } else {
836+ sector_div(total, 10);
837+ pmd->metadata_reserve = min(max_blocks, total);
838+ }
839+}
840+
819841 struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
820842 sector_t data_block_size,
821843 bool format_device)
@@ -849,6 +871,8 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev, · 27 unmodified lines
849871 return ERR_PTR(r);
850872 }
851873
874+ __set_metadata_reserve(pmd);
875+
852876 return pmd;
853877 }
854878
@@ -1820,6 +1844,13 @@ int dm_pool_get_free_metadata_block_count(struct dm_pool_metadata *pmd, · 965 unmodified lines
18201844 down_read(&pmd->root_lock);
18211845 if (!pmd->fail_io)
18221846 r = dm_sm_get_nr_free(pmd->metadata_sm, result);
1847+
1848+ if (!r) {
1849+ if (*result < pmd->metadata_reserve)
1850+ *result = 0;
1851+ else
1852+ *result -= pmd->metadata_reserve;
1853+ }
18231854 up_read(&pmd->root_lock);
18241855
18251856 return r;
@@ -1932,8 +1963,11 @@ int dm_pool_resize_metadata_dev(struct dm_pool_metadata *pmd, dm_block_t new_cou · 106 unmodified lines
19321963 int r = -EINVAL;
19331964
19341965 down_write(&pmd->root_lock);
1935− if (!pmd->fail_io)
1966+ if (!pmd->fail_io) {
19361967 r = __resize_space_map(pmd->metadata_sm, new_count);
1968+ if (!r)
1969+ __set_metadata_reserve(pmd);
1970+ }
19371971 up_write(&pmd->root_lock);
19381972
19391973 return r;
drivers/md/dm-thin.c+65−8
@@ -200,7 +200,13 @@ struct dm_thin_new_mapping; · 199 unmodified lines
200200 enum pool_mode {
201201 PM_WRITE, /* metadata may be changed */
202202 PM_OUT_OF_DATA_SPACE, /* metadata may be changed, though data may not be allocated */
203+
204+ /*
205+ * Like READ_ONLY, except may switch back to WRITE on metadata resize. Reported as READ_ONLY.
206+ */
207+ PM_OUT_OF_METADATA_SPACE,
203208 PM_READ_ONLY, /* metadata may not be changed */
209+
204210 PM_FAIL, /* all I/O fails */
205211 };
206212
@@ -1371,7 +1377,35 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); · 1164 unmodified lines
13711377
13721378 static void requeue_bios(struct pool *pool);
13731379
1374−static void check_for_space(struct pool *pool)
1380+static bool is_read_only_pool_mode(enum pool_mode mode)
1381+{
1382+ return (mode == PM_OUT_OF_METADATA_SPACE || mode == PM_READ_ONLY);
1383+}
1384+
1385+static bool is_read_only(struct pool *pool)
1386+{
1387+ return is_read_only_pool_mode(get_pool_mode(pool));
1388+}
1389+
1390+static void check_for_metadata_space(struct pool *pool)
1391+{
1392+ int r;
1393+ const char *ooms_reason = NULL;
1394+ dm_block_t nr_free;
1395+
1396+ r = dm_pool_get_free_metadata_block_count(pool->pmd, &nr_free);
1397+ if (r)
1398+ ooms_reason = "Could not get free metadata blocks";
1399+ else if (!nr_free)
1400+ ooms_reason = "No free metadata blocks";
1401+
1402+ if (ooms_reason && !is_read_only(pool)) {
1403+ DMERR("%s", ooms_reason);
1404+ set_pool_mode(pool, PM_OUT_OF_METADATA_SPACE);
1405+ }
1406+}
1407+
1408+static void check_for_data_space(struct pool *pool)
13751409 {
13761410 int r;
13771411 dm_block_t nr_free;
@@ -1397,14 +1431,16 @@ static int commit(struct pool *pool) · 19 unmodified lines
13971431 {
13981432 int r;
13991433
1400− if (get_pool_mode(pool) >= PM_READ_ONLY)
1434+ if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE)
14011435 return -EINVAL;
14021436
14031437 r = dm_pool_commit_metadata(pool->pmd);
14041438 if (r)
14051439 metadata_operation_failed(pool, "dm_pool_commit_metadata", r);
1406− else
1407− check_for_space(pool);
1440+ else {
1441+ check_for_metadata_space(pool);
1442+ check_for_data_space(pool);
1443+ }
14081444
14091445 return r;
14101446 }
@@ -1470,6 +1506,19 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) · 59 unmodified lines
14701506 return r;
14711507 }
14721508
1509+ r = dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks);
1510+ if (r) {
1511+ metadata_operation_failed(pool, "dm_pool_get_free_metadata_block_count", r);
1512+ return r;
1513+ }
1514+
1515+ if (!free_blocks) {
1516+ /* Let's commit before we use up the metadata reserve. */
1517+ r = commit(pool);
1518+ if (r)
1519+ return r;
1520+ }
1521+
14731522 return 0;
14741523 }
14751524
@@ -1501,6 +1550,7 @@ static blk_status_t should_error_unserviceable_bio(struct pool *pool) · 25 unmodified lines
15011550 case PM_OUT_OF_DATA_SPACE:
15021551 return pool->pf.error_if_no_space ? BLK_STS_NOSPC : 0;
15031552
1553+ case PM_OUT_OF_METADATA_SPACE:
15041554 case PM_READ_ONLY:
15051555 case PM_FAIL:
15061556 return BLK_STS_IOERR;
@@ -2464,8 +2514,9 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) · 957 unmodified lines
24642514 error_retry_list(pool);
24652515 break;
24662516
2517+ case PM_OUT_OF_METADATA_SPACE:
24672518 case PM_READ_ONLY:
2468− if (old_mode != new_mode)
2519+ if (!is_read_only_pool_mode(old_mode))
24692520 notify_of_pool_mode_change(pool, "read-only");
24702521 dm_pool_metadata_read_only(pool->pmd);
24712522 pool->process_bio = process_bio_read_only;
@@ -3403,6 +3454,10 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) · 931 unmodified lines
34033454 DMINFO("%s: growing the metadata device from %llu to %llu blocks",
34043455 dm_device_name(pool->pool_md),
34053456 sb_metadata_dev_size, metadata_dev_size);
3457+
3458+ if (get_pool_mode(pool) == PM_OUT_OF_METADATA_SPACE)
3459+ set_pool_mode(pool, PM_WRITE);
3460+
34063461 r = dm_pool_resize_metadata_dev(pool->pmd, metadata_dev_size);
34073462 if (r) {
34083463 metadata_operation_failed(pool, "dm_pool_resize_metadata_dev", r);
@@ -3707,7 +3762,7 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv, · 298 unmodified lines
37073762 struct pool_c *pt = ti->private;
37083763 struct pool *pool = pt->pool;
37093764
3710− if (get_pool_mode(pool) >= PM_READ_ONLY) {
3765+ if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE) {
37113766 DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
37123767 dm_device_name(pool->pool_md));
37133768 return -EOPNOTSUPP;
@@ -3781,6 +3836,7 @@ static void pool_status(struct dm_target *ti, status_type_t type, · 67 unmodified lines
37813836 dm_block_t nr_blocks_data;
37823837 dm_block_t nr_blocks_metadata;
37833838 dm_block_t held_root;
3839+ enum pool_mode mode;
37843840 char buf[BDEVNAME_SIZE];
37853841 char buf2[BDEVNAME_SIZE];
37863842 struct pool_c *pt = ti->private;
@@ -3851,9 +3907,10 @@ static void pool_status(struct dm_target *ti, status_type_t type, · 64 unmodified lines
38513907 else
38523908 DMEMIT("- ");
38533909
3854− if (pool->pf.mode == PM_OUT_OF_DATA_SPACE)
3910+ mode = get_pool_mode(pool);
3911+ if (mode == PM_OUT_OF_DATA_SPACE)
38553912 DMEMIT("out_of_data_space ");
3856− else if (pool->pf.mode == PM_READ_ONLY)
3913+ else if (is_read_only_pool_mode(mode))
38573914 DMEMIT("ro ");
38583915 else
38593916 DMEMIT("rw ");
drivers/md/dm-verity-target.c+20−4
@@ -99,10 +99,26 @@ static int verity_hash_update(struct dm_verity *v, struct ahash_request *req, · 98 unmodified lines
9999 {
100100 struct scatterlist sg;
101101
102− sg_init_one(&sg, data, len);
103− ahash_request_set_crypt(req, &sg, NULL, len);
104−
105− return crypto_wait_req(crypto_ahash_update(req), wait);
102+ if (likely(!is_vmalloc_addr(data))) {
103+ sg_init_one(&sg, data, len);
104+ ahash_request_set_crypt(req, &sg, NULL, len);
105+ return crypto_wait_req(crypto_ahash_update(req), wait);
106+ } else {
107+ do {
108+ int r;
109+ size_t this_step = min_t(size_t, len, PAGE_SIZE - offset_in_page(data));
110+ flush_kernel_vmap_range((void *)data, this_step);
111+ sg_init_table(&sg, 1);
112+ sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data));
113+ ahash_request_set_crypt(req, &sg, NULL, this_step);
114+ r = crypto_wait_req(crypto_ahash_update(req), wait);
115+ if (unlikely(r))
116+ return r;
117+ data += this_step;
118+ len -= this_step;
119+ } while (len);
120+ return 0;
121+ }
106122 }
107123
108124 /*
drivers/md/md-cluster.c+5−5
@@ -1276,18 +1276,18 @@ static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi) · 1275 unmodified lines
12761276 static int resync_finish(struct mddev *mddev)
12771277 {
12781278 struct md_cluster_info *cinfo = mddev->cluster_info;
1279+ int ret = 0;
12791280
12801281 clear_bit(MD_RESYNCING_REMOTE, &mddev->recovery);
1281− dlm_unlock_sync(cinfo->resync_lockres);
12821282
12831283 /*
12841284 * If resync thread is interrupted so we can't say resync is finished,
12851285 * another node will launch resync thread to continue.
12861286 */
1287− if (test_bit(MD_CLOSING, &mddev->flags))
1288− return 0;
1289− else
1290− return resync_info_update(mddev, 0, 0);
1287+ if (!test_bit(MD_CLOSING, &mddev->flags))
1288+ ret = resync_info_update(mddev, 0, 0);
1289+ dlm_unlock_sync(cinfo->resync_lockres);
1290+ return ret;
12911291 }
12921292
12931293 static int area_resyncing(struct mddev *mddev, int direction,
drivers/md/raid10.c+4−1
@@ -4529,11 +4529,12 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, · 4528 unmodified lines
45294529 allow_barrier(conf);
45304530 }
45314531
4532+ raise_barrier(conf, 0);
45324533 read_more:
45334534 /* Now schedule reads for blocks from sector_nr to last */
45344535 r10_bio = raid10_alloc_init_r10buf(conf);
45354536 r10_bio->state = 0;
4536− raise_barrier(conf, sectors_done != 0);
4537+ raise_barrier(conf, 1);
45374538 atomic_set(&r10_bio->remaining, 0);
45384539 r10_bio->mddev = mddev;
45394540 r10_bio->sector = sector_nr;
@@ -4629,6 +4630,8 @@ read_more: · 89 unmodified lines
46294630 if (sector_nr <= last)
46304631 goto read_more;
46314632
4633+ lower_barrier(conf);
4634+
46324635 /* Now that we have done the whole section we can
46334636 * update reshape_progress
46344637 */
drivers/md/raid5-log.h+5−0
@@ -46,6 +46,11 @@ extern int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add); · 45 unmodified lines
4646 extern void ppl_quiesce(struct r5conf *conf, int quiesce);
4747 extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio);
4848
49+static inline bool raid5_has_log(struct r5conf *conf)
50+{
51+ return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
52+}
53+
4954 static inline bool raid5_has_ppl(struct r5conf *conf)
5055 {
5156 return test_bit(MD_HAS_PPL, &conf->mddev->flags);
drivers/md/raid5.c+3−3
@@ -733,7 +733,7 @@ static bool stripe_can_batch(struct stripe_head *sh) · 732 unmodified lines
733733 {
734734 struct r5conf *conf = sh->raid_conf;
735735
736− if (conf->log || raid5_has_ppl(conf))
736+ if (raid5_has_log(conf) || raid5_has_ppl(conf))
737737 return false;
738738 return test_bit(STRIPE_BATCH_READY, &sh->state) &&
739739 !test_bit(STRIPE_BITMAP_PENDING, &sh->state) &&
@@ -7737,7 +7737,7 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors) · 6997 unmodified lines
77377737 sector_t newsize;
77387738 struct r5conf *conf = mddev->private;
77397739
7740− if (conf->log || raid5_has_ppl(conf))
7740+ if (raid5_has_log(conf) || raid5_has_ppl(conf))
77417741 return -EINVAL;
77427742 sectors &= ~((sector_t)conf->chunk_sectors - 1);
77437743 newsize = raid5_size(mddev, sectors, mddev->raid_disks);
@@ -7788,7 +7788,7 @@ static int check_reshape(struct mddev *mddev) · 44 unmodified lines
77887788 {
77897789 struct r5conf *conf = mddev->private;
77907790
7791− if (conf->log || raid5_has_ppl(conf))
7791+ if (raid5_has_log(conf) || raid5_has_ppl(conf))
77927792 return -EINVAL;
77937793 if (mddev->delta_disks == 0 &&
77947794 mddev->new_layout == mddev->layout &&
drivers/media/i2c/mt9v111.c+13−28
@@ -1159,41 +1159,21 @@ static int mt9v111_probe(struct i2c_client *client) · 1158 unmodified lines
11591159 V4L2_CID_AUTO_WHITE_BALANCE,
11601160 0, 1, 1,
11611161 V4L2_WHITE_BALANCE_AUTO);
1162− if (IS_ERR_OR_NULL(mt9v111->auto_awb)) {
1163− ret = PTR_ERR(mt9v111->auto_awb);
1164− goto error_free_ctrls;
1165− }
1166−
11671162 mt9v111->auto_exp = v4l2_ctrl_new_std_menu(&mt9v111->ctrls,
11681163 &mt9v111_ctrl_ops,
11691164 V4L2_CID_EXPOSURE_AUTO,
11701165 V4L2_EXPOSURE_MANUAL,
11711166 0, V4L2_EXPOSURE_AUTO);
1172− if (IS_ERR_OR_NULL(mt9v111->auto_exp)) {
1173− ret = PTR_ERR(mt9v111->auto_exp);
1174− goto error_free_ctrls;
1175− }
1176−
1177− /* Initialize timings */
11781167 mt9v111->hblank = v4l2_ctrl_new_std(&mt9v111->ctrls, &mt9v111_ctrl_ops,
11791168 V4L2_CID_HBLANK,
11801169 MT9V111_CORE_R05_MIN_HBLANK,
11811170 MT9V111_CORE_R05_MAX_HBLANK, 1,
11821171 MT9V111_CORE_R05_DEF_HBLANK);
1183− if (IS_ERR_OR_NULL(mt9v111->hblank)) {
1184− ret = PTR_ERR(mt9v111->hblank);
1185− goto error_free_ctrls;
1186− }
1187−
11881172 mt9v111->vblank = v4l2_ctrl_new_std(&mt9v111->ctrls, &mt9v111_ctrl_ops,
11891173 V4L2_CID_VBLANK,
11901174 MT9V111_CORE_R06_MIN_VBLANK,
11911175 MT9V111_CORE_R06_MAX_VBLANK, 1,
11921176 MT9V111_CORE_R06_DEF_VBLANK);
1193− if (IS_ERR_OR_NULL(mt9v111->vblank)) {
1194− ret = PTR_ERR(mt9v111->vblank);
1195− goto error_free_ctrls;
1196− }
11971177
11981178 /* PIXEL_RATE is fixed: just expose it to user space. */
11991179 v4l2_ctrl_new_std(&mt9v111->ctrls, &mt9v111_ctrl_ops,
@@ -1201,6 +1181,10 @@ static int mt9v111_probe(struct i2c_client *client) · 1 unmodified line
12011181 DIV_ROUND_CLOSEST(mt9v111->sysclk, 2), 1,
12021182 DIV_ROUND_CLOSEST(mt9v111->sysclk, 2));
12031183
1184+ if (mt9v111->ctrls.error) {
1185+ ret = mt9v111->ctrls.error;
1186+ goto error_free_ctrls;
1187+ }
12041188 mt9v111->sd.ctrl_handler = &mt9v111->ctrls;
12051189
12061190 /* Start with default configuration: 640x480 UYVY. */
@@ -1226,26 +1210,27 @@ static int mt9v111_probe(struct i2c_client *client) · 19 unmodified lines
12261210 mt9v111->pad.flags = MEDIA_PAD_FL_SOURCE;
12271211 ret = media_entity_pads_init(&mt9v111->sd.entity, 1, &mt9v111->pad);
12281212 if (ret)
1229− goto error_free_ctrls;
1213+ goto error_free_entity;
12301214 #endif
12311215
12321216 ret = mt9v111_chip_probe(mt9v111);
12331217 if (ret)
1234− goto error_free_ctrls;
1218+ goto error_free_entity;
12351219
12361220 ret = v4l2_async_register_subdev(&mt9v111->sd);
12371221 if (ret)
1238− goto error_free_ctrls;
1222+ goto error_free_entity;
12391223
12401224 return 0;
12411225
1242−error_free_ctrls:
1243− v4l2_ctrl_handler_free(&mt9v111->ctrls);
1244−
1226+error_free_entity:
12451227 #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
12461228 media_entity_cleanup(&mt9v111->sd.entity);
12471229 #endif
12481230
1231+error_free_ctrls:
1232+ v4l2_ctrl_handler_free(&mt9v111->ctrls);
1233+
12491234 mutex_destroy(&mt9v111->pwr_mutex);
12501235 mutex_destroy(&mt9v111->stream_mutex);
12511236
@@ -1259,12 +1244,12 @@ static int mt9v111_remove(struct i2c_client *client) · 7 unmodified lines
12591244
12601245 v4l2_async_unregister_subdev(sd);
12611246
1262− v4l2_ctrl_handler_free(&mt9v111->ctrls);
1263−
12641247 #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
12651248 media_entity_cleanup(&sd->entity);
12661249 #endif
12671250
1251+ v4l2_ctrl_handler_free(&mt9v111->ctrls);
1252+
12681253 mutex_destroy(&mt9v111->pwr_mutex);
12691254 mutex_destroy(&mt9v111->stream_mutex);
12701255
drivers/media/platform/Kconfig+2−0
@@ -541,6 +541,8 @@ config VIDEO_CROS_EC_CEC · 540 unmodified lines
541541 depends on MFD_CROS_EC
542542 select CEC_CORE
543543 select CEC_NOTIFIER
544+ select CHROME_PLATFORMS
545+ select CROS_EC_PROTO
544546 ---help---
545547 If you say yes here you will get support for the
546548 ChromeOS Embedded Controller's CEC.
drivers/media/platform/qcom/camss/camss-csid.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/clk.h>
1111 #include <linux/completion.h>
1212 #include <linux/interrupt.h>
13+#include <linux/io.h>
1314 #include <linux/kernel.h>
1415 #include <linux/of.h>
1516 #include <linux/platform_device.h>
drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <linux/delay.h>
1414 #include <linux/interrupt.h>
15+#include <linux/io.h>
1516
1617 #define CAMSS_CSI_PHY_LNn_CFG2(n) (0x004 + 0x40 * (n))
1718 #define CAMSS_CSI_PHY_LNn_CFG3(n) (0x008 + 0x40 * (n))
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <linux/delay.h>
1414 #include <linux/interrupt.h>
15+#include <linux/io.h>
1516
1617 #define CSIPHY_3PH_LNn_CFG1(n) (0x000 + 0x100 * (n))
1718 #define CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG (BIT(7) | BIT(6))
drivers/media/platform/qcom/camss/camss-csiphy.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/clk.h>
1111 #include <linux/delay.h>
1212 #include <linux/interrupt.h>
13+#include <linux/io.h>
1314 #include <linux/kernel.h>
1415 #include <linux/of.h>
1516 #include <linux/platform_device.h>
drivers/media/platform/qcom/camss/camss-ispif.c+3−2
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/clk.h>
1111 #include <linux/completion.h>
1212 #include <linux/interrupt.h>
13+#include <linux/io.h>
1314 #include <linux/iopoll.h>
1415 #include <linux/kernel.h>
1516 #include <linux/mutex.h>
@@ -1076,8 +1077,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif, · 1060 unmodified lines
10761077 else
10771078 return -EINVAL;
10781079
1079− ispif->line = kcalloc(ispif->line_num, sizeof(*ispif->line),
1080− GFP_KERNEL);
1080+ ispif->line = devm_kcalloc(dev, ispif->line_num, sizeof(*ispif->line),
1081+ GFP_KERNEL);
10811082 if (!ispif->line)
10821083 return -ENOMEM;
10831084
drivers/media/platform/qcom/camss/camss-vfe-4-1.c+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 */
1010
1111 #include <linux/interrupt.h>
12+#include <linux/io.h>
1213 #include <linux/iopoll.h>
1314
1415 #include "camss-vfe.h"
drivers/media/platform/qcom/camss/camss-vfe-4-7.c+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 */
1010
1111 #include <linux/interrupt.h>
12+#include <linux/io.h>
1213 #include <linux/iopoll.h>
1314
1415 #include "camss-vfe.h"
drivers/media/platform/qcom/camss/camss.c+8−7
@@ -848,17 +848,18 @@ static int camss_probe(struct platform_device *pdev) · 847 unmodified lines
848848 return -EINVAL;
849849 }
850850
851− camss->csiphy = kcalloc(camss->csiphy_num, sizeof(*camss->csiphy),
852− GFP_KERNEL);
851+ camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
852+ sizeof(*camss->csiphy), GFP_KERNEL);
853853 if (!camss->csiphy)
854854 return -ENOMEM;
855855
856− camss->csid = kcalloc(camss->csid_num, sizeof(*camss->csid),
857− GFP_KERNEL);
856+ camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
857+ GFP_KERNEL);
858858 if (!camss->csid)
859859 return -ENOMEM;
860860
861− camss->vfe = kcalloc(camss->vfe_num, sizeof(*camss->vfe), GFP_KERNEL);
861+ camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
862+ GFP_KERNEL);
862863 if (!camss->vfe)
863864 return -ENOMEM;
864865
@@ -993,12 +994,12 @@ static const struct of_device_id camss_dt_match[] = { · 128 unmodified lines
993994
994995 MODULE_DEVICE_TABLE(of, camss_dt_match);
995996
996−static int camss_runtime_suspend(struct device *dev)
997+static int __maybe_unused camss_runtime_suspend(struct device *dev)
997998 {
998999 return 0;
9991000 }
10001001
1001−static int camss_runtime_resume(struct device *dev)
1002+static int __maybe_unused camss_runtime_resume(struct device *dev)
10021003 {
10031004 return 0;
10041005 }
drivers/media/usb/dvb-usb-v2/af9035.c+4−2
@@ -402,8 +402,10 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, · 401 unmodified lines
402402 if (msg[0].addr == state->af9033_i2c_addr[1])
403403 reg |= 0x100000;
404404
405− ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
406− msg[0].len - 3);
405+ ret = (msg[0].len >= 3) ? af9035_wr_regs(d, reg,
406+ &msg[0].buf[3],
407+ msg[0].len - 3)
408+ : -EOPNOTSUPP;
407409 } else {
408410 /* I2C write */
409411 u8 buf[MAX_XFER_SIZE];
drivers/memory/ti-aemif.c+1−1
@@ -411,7 +411,7 @@ static int aemif_probe(struct platform_device *pdev) · 410 unmodified lines
411411 if (ret < 0)
412412 goto error;
413413 }
414− } else {
414+ } else if (pdata) {
415415 for (i = 0; i < pdata->num_sub_devices; i++) {
416416 pdata->sub_devices[i].dev.parent = dev;
417417 ret = platform_device_register(&pdata->sub_devices[i]);
drivers/mfd/omap-usb-host.c+6−5
@@ -528,8 +528,8 @@ static int usbhs_omap_get_dt_pdata(struct device *dev, · 527 unmodified lines
528528 }
529529
530530 static const struct of_device_id usbhs_child_match_table[] = {
531− { .compatible = "ti,omap-ehci", },
532− { .compatible = "ti,omap-ohci", },
531+ { .compatible = "ti,ehci-omap", },
532+ { .compatible = "ti,ohci-omap3", },
533533 { }
534534 };
535535
@@ -855,6 +855,7 @@ static struct platform_driver usbhs_omap_driver = { · 319 unmodified lines
855855 .pm = &usbhsomap_dev_pm_ops,
856856 .of_match_table = usbhs_omap_dt_ids,
857857 },
858+ .probe = usbhs_omap_probe,
858859 .remove = usbhs_omap_remove,
859860 };
860861
@@ -864,9 +865,9 @@ MODULE_ALIAS("platform:" USBHS_DRIVER_NAME); · 3 unmodified lines
864865 MODULE_LICENSE("GPL v2");
865866 MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
866867
867−static int __init omap_usbhs_drvinit(void)
868+static int omap_usbhs_drvinit(void)
868869 {
869− return platform_driver_probe(&usbhs_omap_driver, usbhs_omap_probe);
870+ return platform_driver_register(&usbhs_omap_driver);
870871 }
871872
872873 /*
@@ -878,7 +879,7 @@ static int __init omap_usbhs_drvinit(void) · 5 unmodified lines
878879 */
879880 fs_initcall_sync(omap_usbhs_drvinit);
880881
881−static void __exit omap_usbhs_drvexit(void)
882+static void omap_usbhs_drvexit(void)
882883 {
883884 platform_driver_unregister(&usbhs_omap_driver);
884885 }
drivers/misc/hmc6352.c+2−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/err.h>
2828 #include <linux/delay.h>
2929 #include <linux/sysfs.h>
30+#include <linux/nospec.h>
3031
3132 static DEFINE_MUTEX(compass_mutex);
3233
@@ -50,6 +51,7 @@ static int compass_store(struct device *dev, const char *buf, size_t count, · 17 unmodified lines
5051 return ret;
5152 if (val >= strlen(map))
5253 return -EINVAL;
54+ val = array_index_nospec(val, strlen(map));
5355 mutex_lock(&compass_mutex);
5456 ret = compass_command(c, map[val]);
5557 mutex_unlock(&compass_mutex);
drivers/misc/ibmvmc.c+1−1
@@ -2131,7 +2131,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_adapter *adapter) · 2130 unmodified lines
21312131 retrc = plpar_hcall_norets(H_REG_CRQ,
21322132 vdev->unit_address,
21332133 queue->msg_token, PAGE_SIZE);
2134− retrc = rc;
2134+ rc = retrc;
21352135
21362136 if (rc == H_RESOURCE)
21372137 rc = ibmvmc_reset_crq_queue(adapter);
drivers/misc/mei/bus.c+5−7
@@ -521,17 +521,15 @@ int mei_cldev_enable(struct mei_cl_device *cldev) · 520 unmodified lines
521521
522522 cl = cldev->cl;
523523
524+ mutex_lock(&bus->device_lock);
524525 if (cl->state == MEI_FILE_UNINITIALIZED) {
525− mutex_lock(&bus->device_lock);
526526 ret = mei_cl_link(cl);
527− mutex_unlock(&bus->device_lock);
528527 if (ret)
529− return ret;
528+ goto out;
530529 /* update pointers */
531530 cl->cldev = cldev;
532531 }
533532
534− mutex_lock(&bus->device_lock);
535533 if (mei_cl_is_connected(cl)) {
536534 ret = 0;
537535 goto out;
@@ -616,9 +614,8 @@ int mei_cldev_disable(struct mei_cl_device *cldev) · 78 unmodified lines
616614 if (err < 0)
617615 dev_err(bus->dev, "Could not disconnect from the ME client\n");
618616
619−out:
620617 mei_cl_bus_module_put(cldev);
621−
618+out:
622619 /* Flush queues and remove any pending read */
623620 mei_cl_flush_queues(cl, NULL);
624621 mei_cl_unlink(cl);
@@ -876,12 +873,13 @@ static void mei_cl_bus_dev_release(struct device *dev) · 251 unmodified lines
876873
877874 mei_me_cl_put(cldev->me_cl);
878875 mei_dev_bus_put(cldev->bus);
876+ mei_cl_unlink(cldev->cl);
879877 kfree(cldev->cl);
880878 kfree(cldev);
881879 }
882880
883881 static const struct device_type mei_cl_device_type = {
884− .release = mei_cl_bus_dev_release,
882+ .release = mei_cl_bus_dev_release,
885883 };
886884
887885 /**
drivers/misc/mei/client.c+1−1
@@ -1767,7 +1767,7 @@ out: · 1766 unmodified lines
17671767 }
17681768 }
17691769
1770− rets = buf->size;
1770+ rets = len;
17711771 err:
17721772 cl_dbg(dev, cl, "rpm: autosuspend\n");
17731773 pm_runtime_mark_last_busy(dev->dev);
drivers/misc/mei/hbm.c+6−3
@@ -1161,15 +1161,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) · 1160 unmodified lines
11611161
11621162 props_res = (struct hbm_props_response *)mei_msg;
11631163
1164− if (props_res->status) {
1164+ if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) {
1165+ dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n",
1166+ props_res->me_addr);
1167+ } else if (props_res->status) {
11651168 dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n",
11661169 props_res->status,
11671170 mei_hbm_status_str(props_res->status));
11681171 return -EPROTO;
1172+ } else {
1173+ mei_hbm_me_cl_add(dev, props_res);
11691174 }
11701175
1171− mei_hbm_me_cl_add(dev, props_res);
1172−
11731176 /* request property for the next client */
11741177 if (mei_hbm_prop_req(dev, props_res->me_addr + 1))
11751178 return -EIO;
drivers/mmc/host/meson-mx-sdio.c+6−2
@@ -517,19 +517,23 @@ static struct mmc_host_ops meson_mx_mmc_ops = { · 516 unmodified lines
517517 static struct platform_device *meson_mx_mmc_slot_pdev(struct device *parent)
518518 {
519519 struct device_node *slot_node;
520+ struct platform_device *pdev;
520521
521522 /*
522523 * TODO: the MMC core framework currently does not support
523524 * controllers with multiple slots properly. So we only register
524525 * the first slot for now
525526 */
526− slot_node = of_find_compatible_node(parent->of_node, NULL, "mmc-slot");
527+ slot_node = of_get_compatible_child(parent->of_node, "mmc-slot");
527528 if (!slot_node) {
528529 dev_warn(parent, "no 'mmc-slot' sub-node found\n");
529530 return ERR_PTR(-ENOENT);
530531 }
531532
532− return of_platform_device_create(slot_node, NULL, parent);
533+ pdev = of_platform_device_create(slot_node, NULL, parent);
534+ of_node_put(slot_node);
535+
536+ return pdev;
533537 }
534538
535539 static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host)
drivers/mmc/host/omap_hsmmc.c+1−0
@@ -2177,6 +2177,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev) · 2176 unmodified lines
21772177 dma_release_channel(host->tx_chan);
21782178 dma_release_channel(host->rx_chan);
21792179
2180+ dev_pm_clear_wake_irq(host->dev);
21802181 pm_runtime_dont_use_autosuspend(host->dev);
21812182 pm_runtime_put_sync(host->dev);
21822183 pm_runtime_disable(host->dev);
drivers/mtd/devices/m25p80.c+23−3
@@ -39,13 +39,23 @@ static int m25p80_read_reg(struct spi_nor *nor, u8 code, u8 *val, int len) · 38 unmodified lines
3939 struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(code, 1),
4040 SPI_MEM_OP_NO_ADDR,
4141 SPI_MEM_OP_NO_DUMMY,
42− SPI_MEM_OP_DATA_IN(len, val, 1));
42+ SPI_MEM_OP_DATA_IN(len, NULL, 1));
43+ void *scratchbuf;
4344 int ret;
4445
46+ scratchbuf = kmalloc(len, GFP_KERNEL);
47+ if (!scratchbuf)
48+ return -ENOMEM;
49+
50+ op.data.buf.in = scratchbuf;
4551 ret = spi_mem_exec_op(flash->spimem, &op);
4652 if (ret < 0)
4753 dev_err(&flash->spimem->spi->dev, "error %d reading %x\n", ret,
4854 code);
55+ else
56+ memcpy(val, scratchbuf, len);
57+
58+ kfree(scratchbuf);
4959
5060 return ret;
5161 }
@@ -56,9 +66,19 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) · 4 unmodified lines
5666 struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 1),
5767 SPI_MEM_OP_NO_ADDR,
5868 SPI_MEM_OP_NO_DUMMY,
59− SPI_MEM_OP_DATA_OUT(len, buf, 1));
69+ SPI_MEM_OP_DATA_OUT(len, NULL, 1));
70+ void *scratchbuf;
71+ int ret;
6072
61− return spi_mem_exec_op(flash->spimem, &op);
73+ scratchbuf = kmemdup(buf, len, GFP_KERNEL);
74+ if (!scratchbuf)
75+ return -ENOMEM;
76+
77+ op.data.buf.out = scratchbuf;
78+ ret = spi_mem_exec_op(flash->spimem, &op);
79+ kfree(scratchbuf);
80+
81+ return ret;
6282 }
6383
6484 static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
drivers/mtd/mtdpart.c+4−1
@@ -873,8 +873,11 @@ static int mtd_part_of_parse(struct mtd_info *master, · 872 unmodified lines
873873 int ret, err = 0;
874874
875875 np = mtd_get_of_node(master);
876− if (!mtd_is_partition(master))
876+ if (mtd_is_partition(master))
877+ of_node_get(np);
878+ else
877879 np = of_get_child_by_name(np, "partitions");
880+
878881 of_property_for_each_string(np, "compatible", prop, compat) {
879882 parser = mtd_part_get_compatible_parser(compat);
880883 if (!parser)
drivers/mtd/nand/raw/denali.c+6−0
@@ -596,6 +596,12 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, · 595 unmodified lines
596596 }
597597
598598 iowrite32(DMA_ENABLE__FLAG, denali->reg + DMA_ENABLE);
599+ /*
600+ * The ->setup_dma() hook kicks DMA by using the data/command
601+ * interface, which belongs to a different AXI port from the
602+ * register interface. Read back the register to avoid a race.
603+ */
604+ ioread32(denali->reg + DMA_ENABLE);
599605
600606 denali_reset_irq(denali);
601607 denali->setup_dma(denali, dma_addr, page, write);
drivers/mtd/nand/raw/marvell_nand.c+3−1
@@ -1547,7 +1547,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip, · 1546 unmodified lines
15471547 for (op_id = 0; op_id < subop->ninstrs; op_id++) {
15481548 unsigned int offset, naddrs;
15491549 const u8 *addrs;
1550− int len = nand_subop_get_data_len(subop, op_id);
1550+ int len;
15511551
15521552 instr = &subop->instrs[op_id];
15531553
@@ -1593,6 +1593,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip, · 39 unmodified lines
15931593 nfc_op->ndcb[0] |=
15941594 NDCB0_CMD_XTYPE(XTYPE_MONOLITHIC_RW) |
15951595 NDCB0_LEN_OVRD;
1596+ len = nand_subop_get_data_len(subop, op_id);
15961597 nfc_op->ndcb[3] |= round_up(len, FIFO_DEPTH);
15971598 }
15981599 nfc_op->data_delay_ns = instr->delay_ns;
@@ -1606,6 +1607,7 @@ static void marvell_nfc_parse_instructions(struct nand_chip *chip, · 7 unmodified lines
16061607 nfc_op->ndcb[0] |=
16071608 NDCB0_CMD_XTYPE(XTYPE_MONOLITHIC_RW) |
16081609 NDCB0_LEN_OVRD;
1610+ len = nand_subop_get_data_len(subop, op_id);
16091611 nfc_op->ndcb[3] |= round_up(len, FIFO_DEPTH);
16101612 }
16111613 nfc_op->data_delay_ns = instr->delay_ns;
drivers/net/appletalk/ipddp.c+6−2
@@ -283,8 +283,12 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 282 unmodified lines
283283 case SIOCFINDIPDDPRT:
284284 spin_lock_bh(&ipddp_route_lock);
285285 rp = __ipddp_find_route(&rcp);
286− if (rp)
287− memcpy(&rcp2, rp, sizeof(rcp2));
286+ if (rp) {
287+ memset(&rcp2, 0, sizeof(rcp2));
288+ rcp2.ip = rp->ip;
289+ rcp2.at = rp->at;
290+ rcp2.flags = rp->flags;
291+ }
288292 spin_unlock_bh(&ipddp_route_lock);
289293
290294 if (rp) {
drivers/net/bonding/bond_main.c+2−9
@@ -971,16 +971,13 @@ static void bond_poll_controller(struct net_device *bond_dev) · 970 unmodified lines
971971 struct slave *slave = NULL;
972972 struct list_head *iter;
973973 struct ad_info ad_info;
974− struct netpoll_info *ni;
975− const struct net_device_ops *ops;
976974
977975 if (BOND_MODE(bond) == BOND_MODE_8023AD)
978976 if (bond_3ad_get_active_agg_info(bond, &ad_info))
979977 return;
980978
981979 bond_for_each_slave_rcu(bond, slave, iter) {
982− ops = slave->dev->netdev_ops;
983− if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
980+ if (!bond_slave_is_up(slave))
984981 continue;
985982
986983 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
@@ -992,11 +989,7 @@ static void bond_poll_controller(struct net_device *bond_dev) · 5 unmodified lines
992989 continue;
993990 }
994991
995− ni = rcu_dereference_bh(slave->dev->npinfo);
996− if (down_trylock(&ni->dev_lock))
997− continue;
998− ops->ndo_poll_controller(slave->dev);
999− up(&ni->dev_lock);
992+ netpoll_poll_dev(slave->dev);
1000993 }
1001994 }
1002995
drivers/net/dsa/mv88e6xxx/global1.h+1−1
@@ -128,7 +128,7 @@ · 127 unmodified lines
128128 #define MV88E6XXX_G1_ATU_OP_GET_CLR_VIOLATION 0x7000
129129 #define MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION BIT(7)
130130 #define MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION BIT(6)
131−#define MV88E6XXX_G1_ATU_OP_MISS_VIOLTATION BIT(5)
131+#define MV88E6XXX_G1_ATU_OP_MISS_VIOLATION BIT(5)
132132 #define MV88E6XXX_G1_ATU_OP_FULL_VIOLATION BIT(4)
133133
134134 /* Offset 0x0C: ATU Data Register */
drivers/net/dsa/mv88e6xxx/global1_atu.c+1−1
@@ -349,7 +349,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) · 348 unmodified lines
349349 chip->ports[entry.portvec].atu_member_violation++;
350350 }
351351
352− if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) {
352+ if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) {
353353 dev_err_ratelimited(chip->dev,
354354 "ATU miss violation for %pM portvec %x\n",
355355 entry.mac, entry.portvec);
drivers/net/ethernet/amazon/ena/ena_com.c+11−13
@@ -459,12 +459,12 @@ static void ena_com_handle_admin_completion(struct ena_com_admin_queue *admin_qu · 458 unmodified lines
459459 cqe = &admin_queue->cq.entries[head_masked];
460460
461461 /* Go over all the completions */
462− while ((cqe->acq_common_descriptor.flags &
462+ while ((READ_ONCE(cqe->acq_common_descriptor.flags) &
463463 ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK) == phase) {
464464 /* Do not read the rest of the completion entry before the
465465 * phase bit was validated
466466 */
467− rmb();
467+ dma_rmb();
468468 ena_com_handle_single_admin_completion(admin_queue, cqe);
469469
470470 head_masked++;
@@ -627,17 +627,10 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset) · 156 unmodified lines
627627 mmio_read_reg |= mmio_read->seq_num &
628628 ENA_REGS_MMIO_REG_READ_REQ_ID_MASK;
629629
630− /* make sure read_resp->req_id get updated before the hw can write
631− * there
632− */
633− wmb();
634−
635− writel_relaxed(mmio_read_reg,
636− ena_dev->reg_bar + ENA_REGS_MMIO_REG_READ_OFF);
630+ writel(mmio_read_reg, ena_dev->reg_bar + ENA_REGS_MMIO_REG_READ_OFF);
637631
638− mmiowb();
639632 for (i = 0; i < timeout; i++) {
640− if (read_resp->req_id == mmio_read->seq_num)
633+ if (READ_ONCE(read_resp->req_id) == mmio_read->seq_num)
641634 break;
642635
643636 udelay(1);
@@ -1796,8 +1789,13 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data) · 1152 unmodified lines
17961789 aenq_common = &aenq_e->aenq_common_desc;
17971790
17981791 /* Go over all the events */
1799− while ((aenq_common->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) ==
1800− phase) {
1792+ while ((READ_ONCE(aenq_common->flags) &
1793+ ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
1794+ /* Make sure the phase bit (ownership) is as expected before
1795+ * reading the rest of the descriptor.
1796+ */
1797+ dma_rmb();
1798+
18011799 pr_debug("AENQ! Group[%x] Syndrom[%x] timestamp: [%llus]\n",
18021800 aenq_common->group, aenq_common->syndrom,
18031801 (u64)aenq_common->timestamp_low +
drivers/net/ethernet/amazon/ena/ena_eth_com.c+6−0
@@ -51,6 +51,11 @@ static inline struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc( · 50 unmodified lines
5151 if (desc_phase != expected_phase)
5252 return NULL;
5353
54+ /* Make sure we read the rest of the descriptor after the phase bit
55+ * has been read
56+ */
57+ dma_rmb();
58+
5459 return cdesc;
5560 }
5661
@@ -493,6 +498,7 @@ int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq, u16 *req_id) · 436 unmodified lines
493498 if (cdesc_phase != expected_phase)
494499 return -EAGAIN;
495500
501+ dma_rmb();
496502 if (unlikely(cdesc->req_id >= io_cq->q_depth)) {
497503 pr_err("Invalid req id %d\n", cdesc->req_id);
498504 return -EINVAL;
drivers/net/ethernet/amazon/ena/ena_eth_com.h+2−6
@@ -107,8 +107,7 @@ static inline int ena_com_sq_empty_space(struct ena_com_io_sq *io_sq) · 106 unmodified lines
107107 return io_sq->q_depth - 1 - cnt;
108108 }
109109
110−static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq,
111− bool relaxed)
110+static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq)
112111 {
113112 u16 tail;
114113
@@ -117,10 +116,7 @@ static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq, · 2 unmodified lines
117116 pr_debug("write submission queue doorbell for queue: %d tail: %d\n",
118117 io_sq->qid, tail);
119118
120− if (relaxed)
121− writel_relaxed(tail, io_sq->db_addr);
122− else
123− writel(tail, io_sq->db_addr);
119+ writel(tail, io_sq->db_addr);
124120
125121 return 0;
126122 }
drivers/net/ethernet/amazon/ena/ena_netdev.c+37−45
@@ -76,7 +76,7 @@ MODULE_DEVICE_TABLE(pci, ena_pci_tbl); · 75 unmodified lines
7676
7777 static int ena_rss_init_default(struct ena_adapter *adapter);
7878 static void check_for_admin_com_state(struct ena_adapter *adapter);
79−static void ena_destroy_device(struct ena_adapter *adapter);
79+static void ena_destroy_device(struct ena_adapter *adapter, bool graceful);
8080 static int ena_restore_device(struct ena_adapter *adapter);
8181
8282 static void ena_tx_timeout(struct net_device *dev)
@@ -461,7 +461,7 @@ static inline int ena_alloc_rx_page(struct ena_ring *rx_ring, · 378 unmodified lines
461461 return -ENOMEM;
462462 }
463463
464− dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE,
464+ dma = dma_map_page(rx_ring->dev, page, 0, ENA_PAGE_SIZE,
465465 DMA_FROM_DEVICE);
466466 if (unlikely(dma_mapping_error(rx_ring->dev, dma))) {
467467 u64_stats_update_begin(&rx_ring->syncp);
@@ -478,7 +478,7 @@ static inline int ena_alloc_rx_page(struct ena_ring *rx_ring, · 10 unmodified lines
478478 rx_info->page_offset = 0;
479479 ena_buf = &rx_info->ena_buf;
480480 ena_buf->paddr = dma;
481− ena_buf->len = PAGE_SIZE;
481+ ena_buf->len = ENA_PAGE_SIZE;
482482
483483 return 0;
484484 }
@@ -495,7 +495,7 @@ static void ena_free_rx_page(struct ena_ring *rx_ring, · 10 unmodified lines
495495 return;
496496 }
497497
498− dma_unmap_page(rx_ring->dev, ena_buf->paddr, PAGE_SIZE,
498+ dma_unmap_page(rx_ring->dev, ena_buf->paddr, ENA_PAGE_SIZE,
499499 DMA_FROM_DEVICE);
500500
501501 __free_page(page);
@@ -551,14 +551,9 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num) · 49 unmodified lines
551551 rx_ring->qid, i, num);
552552 }
553553
554− if (likely(i)) {
555− /* Add memory barrier to make sure the desc were written before
556− * issue a doorbell
557− */
558− wmb();
559− ena_com_write_sq_doorbell(rx_ring->ena_com_io_sq, true);
560− mmiowb();
561− }
554+ /* ena_com_write_sq_doorbell issues a wmb() */
555+ if (likely(i))
556+ ena_com_write_sq_doorbell(rx_ring->ena_com_io_sq);
562557
563558 rx_ring->next_to_use = next_to_use;
564559
@@ -916,10 +911,10 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring, · 351 unmodified lines
916911 do {
917912 dma_unmap_page(rx_ring->dev,
918913 dma_unmap_addr(&rx_info->ena_buf, paddr),
919− PAGE_SIZE, DMA_FROM_DEVICE);
914+ ENA_PAGE_SIZE, DMA_FROM_DEVICE);
920915
921916 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_info->page,
922− rx_info->page_offset, len, PAGE_SIZE);
917+ rx_info->page_offset, len, ENA_PAGE_SIZE);
923918
924919 netif_dbg(rx_ring->adapter, rx_status, rx_ring->netdev,
925920 "rx skb updated. len %d. data_len %d\n",
@@ -1900,7 +1895,7 @@ static int ena_close(struct net_device *netdev) · 974 unmodified lines
19001895 "Destroy failure, restarting device\n");
19011896 ena_dump_stats_to_dmesg(adapter);
19021897 /* rtnl lock already obtained in dev_ioctl() layer */
1903− ena_destroy_device(adapter);
1898+ ena_destroy_device(adapter, false);
19041899 ena_restore_device(adapter);
19051900 }
19061901
@@ -2112,12 +2107,6 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 205 unmodified lines
21122107 tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use,
21132108 tx_ring->ring_size);
21142109
2115− /* This WMB is aimed to:
2116− * 1 - perform smp barrier before reading next_to_completion
2117− * 2 - make sure the desc were written before trigger DB
2118− */
2119− wmb();
2120−
21212110 /* stop the queue when no more space available, the packet can have up
21222111 * to sgl_size + 2. one for the meta descriptor and one for header
21232112 * (if the header is larger than tx_max_header_size).
@@ -2136,10 +2125,11 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 12 unmodified lines
21362125 * stop the queue but meanwhile clean_tx_irq updates
21372126 * next_to_completion and terminates.
21382127 * The queue will remain stopped forever.
2139− * To solve this issue this function perform rmb, check
2140− * the wakeup condition and wake up the queue if needed.
2128+ * To solve this issue add a mb() to make sure that
2129+ * netif_tx_stop_queue() write is vissible before checking if
2130+ * there is additional space in the queue.
21412131 */
2142− smp_rmb();
2132+ smp_mb();
21432133
21442134 if (ena_com_sq_empty_space(tx_ring->ena_com_io_sq)
21452135 > ENA_TX_WAKEUP_THRESH) {
@@ -2151,8 +2141,10 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 5 unmodified lines
21512141 }
21522142
21532143 if (netif_xmit_stopped(txq) || !skb->xmit_more) {
2154− /* trigger the dma engine */
2155− ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq, false);
2144+ /* trigger the dma engine. ena_com_write_sq_doorbell()
2145+ * has a mb
2146+ */
2147+ ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
21562148 u64_stats_update_begin(&tx_ring->syncp);
21572149 tx_ring->tx_stats.doorbells++;
21582150 u64_stats_update_end(&tx_ring->syncp);
@@ -2550,12 +2542,15 @@ err_disable_msix: · 391 unmodified lines
25502542 return rc;
25512543 }
25522544
2553−static void ena_destroy_device(struct ena_adapter *adapter)
2545+static void ena_destroy_device(struct ena_adapter *adapter, bool graceful)
25542546 {
25552547 struct net_device *netdev = adapter->netdev;
25562548 struct ena_com_dev *ena_dev = adapter->ena_dev;
25572549 bool dev_up;
25582550
2551+ if (!test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
2552+ return;
2553+
25592554 netif_carrier_off(netdev);
25602555
25612556 del_timer_sync(&adapter->timer_service);
@@ -2563,7 +2558,8 @@ static void ena_destroy_device(struct ena_adapter *adapter) · 1 unmodified line
25632558 dev_up = test_bit(ENA_FLAG_DEV_UP, &adapter->flags);
25642559 adapter->dev_up_before_reset = dev_up;
25652560
2566− ena_com_set_admin_running_state(ena_dev, false);
2561+ if (!graceful)
2562+ ena_com_set_admin_running_state(ena_dev, false);
25672563
25682564 if (test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
25692565 ena_down(adapter);
@@ -2591,6 +2587,7 @@ static void ena_destroy_device(struct ena_adapter *adapter) · 21 unmodified lines
25912587 adapter->reset_reason = ENA_REGS_RESET_NORMAL;
25922588
25932589 clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2590+ clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
25942591 }
25952592
25962593 static int ena_restore_device(struct ena_adapter *adapter)
@@ -2635,6 +2632,7 @@ static int ena_restore_device(struct ena_adapter *adapter) · 38 unmodified lines
26352632 }
26362633 }
26372634
2635+ set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
26382636 mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
26392637 dev_err(&pdev->dev, "Device reset completed successfully\n");
26402638
@@ -2665,7 +2663,7 @@ static void ena_fw_reset_device(struct work_struct *work) · 24 unmodified lines
26652663 return;
26662664 }
26672665 rtnl_lock();
2668− ena_destroy_device(adapter);
2666+ ena_destroy_device(adapter, false);
26692667 ena_restore_device(adapter);
26702668 rtnl_unlock();
26712669 }
@@ -3409,30 +3407,24 @@ static void ena_remove(struct pci_dev *pdev) · 737 unmodified lines
34093407 netdev->rx_cpu_rmap = NULL;
34103408 }
34113409 #endif /* CONFIG_RFS_ACCEL */
3412−
3413− unregister_netdev(netdev);
34143410 del_timer_sync(&adapter->timer_service);
34153411
34163412 cancel_work_sync(&adapter->reset_task);
34173413
3418− /* Reset the device only if the device is running. */
3419− if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
3420− ena_com_dev_reset(ena_dev, adapter->reset_reason);
3414+ unregister_netdev(netdev);
34213415
3422− ena_free_mgmnt_irq(adapter);
3416+ /* If the device is running then we want to make sure the device will be
3417+ * reset to make sure no more events will be issued by the device.
3418+ */
3419+ if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
3420+ set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
34233421
3424− ena_disable_msix(adapter);
3422+ rtnl_lock();
3423+ ena_destroy_device(adapter, true);
3424+ rtnl_unlock();
34253425
34263426 free_netdev(netdev);
34273427
3428− ena_com_mmio_reg_read_request_destroy(ena_dev);
3429−
3430− ena_com_abort_admin_commands(ena_dev);
3431−
3432− ena_com_wait_for_abort_completion(ena_dev);
3433−
3434− ena_com_admin_destroy(ena_dev);
3435−
34363428 ena_com_rss_destroy(ena_dev);
34373429
34383430 ena_com_delete_debug_area(ena_dev);
@@ -3467,7 +3459,7 @@ static int ena_suspend(struct pci_dev *pdev, pm_message_t state) · 28 unmodified lines
34673459 "ignoring device reset request as the device is being suspended\n");
34683460 clear_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
34693461 }
3470− ena_destroy_device(adapter);
3462+ ena_destroy_device(adapter, true);
34713463 rtnl_unlock();
34723464 return 0;
34733465 }
drivers/net/ethernet/amazon/ena/ena_netdev.h+11−0
@@ -355,4 +355,15 @@ void ena_dump_stats_to_buf(struct ena_adapter *adapter, u8 *buf); · 354 unmodified lines
355355
356356 int ena_get_sset_count(struct net_device *netdev, int sset);
357357
358+/* The ENA buffer length fields is 16 bit long. So when PAGE_SIZE == 64kB the
359+ * driver passas 0.
360+ * Since the max packet size the ENA handles is ~9kB limit the buffer length to
361+ * 16kB.
362+ */
363+#if PAGE_SIZE > SZ_16K
364+#define ENA_PAGE_SIZE SZ_16K
365+#else
366+#define ENA_PAGE_SIZE PAGE_SIZE
367+#endif
368+
358369 #endif /* !(ENA_H) */
drivers/net/ethernet/apple/bmac.c+2−2
@@ -154,7 +154,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id); · 153 unmodified lines
154154 static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id);
155155 static void bmac_set_timeout(struct net_device *dev);
156156 static void bmac_tx_timeout(struct timer_list *t);
157−static int bmac_output(struct sk_buff *skb, struct net_device *dev);
157+static netdev_tx_t bmac_output(struct sk_buff *skb, struct net_device *dev);
158158 static void bmac_start(struct net_device *dev);
159159
160160 #define DBDMA_SET(x) ( ((x) | (x) << 16) )
@@ -1456,7 +1456,7 @@ bmac_start(struct net_device *dev) · 1295 unmodified lines
14561456 spin_unlock_irqrestore(&bp->lock, flags);
14571457 }
14581458
1459−static int
1459+static netdev_tx_t
14601460 bmac_output(struct sk_buff *skb, struct net_device *dev)
14611461 {
14621462 struct bmac_data *bp = netdev_priv(dev);
drivers/net/ethernet/apple/mace.c+2−2
@@ -78,7 +78,7 @@ struct mace_data { · 77 unmodified lines
7878
7979 static int mace_open(struct net_device *dev);
8080 static int mace_close(struct net_device *dev);
81−static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
81+static netdev_tx_t mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
8282 static void mace_set_multicast(struct net_device *dev);
8383 static void mace_reset(struct net_device *dev);
8484 static int mace_set_address(struct net_device *dev, void *addr);
@@ -525,7 +525,7 @@ static inline void mace_set_timeout(struct net_device *dev) · 440 unmodified lines
525525 mp->timeout_active = 1;
526526 }
527527
528−static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
528+static netdev_tx_t mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
529529 {
530530 struct mace_data *mp = netdev_priv(dev);
531531 volatile struct dbdma_regs __iomem *td = mp->tx_dma;
drivers/net/ethernet/apple/macmace.c+2−2
@@ -89,7 +89,7 @@ struct mace_frame { · 88 unmodified lines
8989
9090 static int mace_open(struct net_device *dev);
9191 static int mace_close(struct net_device *dev);
92−static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
92+static netdev_tx_t mace_xmit_start(struct sk_buff *skb, struct net_device *dev);
9393 static void mace_set_multicast(struct net_device *dev);
9494 static int mace_set_address(struct net_device *dev, void *addr);
9595 static void mace_reset(struct net_device *dev);
@@ -444,7 +444,7 @@ static int mace_close(struct net_device *dev) · 348 unmodified lines
444444 * Transmit a frame
445445 */
446446
447−static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
447+static netdev_tx_t mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
448448 {
449449 struct mace_data *mp = netdev_priv(dev);
450450 unsigned long flags;
drivers/net/ethernet/aquantia/atlantic/aq_ring.c+18−14
@@ -225,9 +225,10 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 224 unmodified lines
225225 }
226226
227227 /* for single fragment packets use build_skb() */
228− if (buff->is_eop) {
228+ if (buff->is_eop &&
229+ buff->len <= AQ_CFG_RX_FRAME_MAX - AQ_SKB_ALIGN) {
229230 skb = build_skb(page_address(buff->page),
230− buff->len + AQ_SKB_ALIGN);
231+ AQ_CFG_RX_FRAME_MAX);
231232 if (unlikely(!skb)) {
232233 err = -ENOMEM;
233234 goto err_exit;
@@ -247,18 +248,21 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 13 unmodified lines
247248 buff->len - ETH_HLEN,
248249 SKB_TRUESIZE(buff->len - ETH_HLEN));
249250
250− for (i = 1U, next_ = buff->next,
251− buff_ = &self->buff_ring[next_]; true;
252− next_ = buff_->next,
253− buff_ = &self->buff_ring[next_], ++i) {
254− skb_add_rx_frag(skb, i, buff_->page, 0,
255− buff_->len,
256− SKB_TRUESIZE(buff->len -
257− ETH_HLEN));
258− buff_->is_cleaned = 1;
259−
260− if (buff_->is_eop)
261− break;
251+ if (!buff->is_eop) {
252+ for (i = 1U, next_ = buff->next,
253+ buff_ = &self->buff_ring[next_];
254+ true; next_ = buff_->next,
255+ buff_ = &self->buff_ring[next_], ++i) {
256+ skb_add_rx_frag(skb, i,
257+ buff_->page, 0,
258+ buff_->len,
259+ SKB_TRUESIZE(buff->len -
260+ ETH_HLEN));
261+ buff_->is_cleaned = 1;
262+
263+ if (buff_->is_eop)
264+ break;
265+ }
262266 }
263267 }
264268
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+0−16
@@ -12894,19 +12894,6 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 12893 unmodified lines
1289412894 }
1289512895 }
1289612896
12897−#ifdef CONFIG_NET_POLL_CONTROLLER
12898−static void poll_bnx2x(struct net_device *dev)
12899−{
12900− struct bnx2x *bp = netdev_priv(dev);
12901− int i;
12902−
12903− for_each_eth_queue(bp, i) {
12904− struct bnx2x_fastpath *fp = &bp->fp[i];
12905− napi_schedule(&bnx2x_fp(bp, fp->index, napi));
12906− }
12907−}
12908−#endif
12909−
1291012897 static int bnx2x_validate_addr(struct net_device *dev)
1291112898 {
1291212899 struct bnx2x *bp = netdev_priv(dev);
@@ -13113,9 +13100,6 @@ static const struct net_device_ops bnx2x_netdev_ops = { · 200 unmodified lines
1311313100 .ndo_tx_timeout = bnx2x_tx_timeout,
1311413101 .ndo_vlan_rx_add_vid = bnx2x_vlan_rx_add_vid,
1311513102 .ndo_vlan_rx_kill_vid = bnx2x_vlan_rx_kill_vid,
13116−#ifdef CONFIG_NET_POLL_CONTROLLER
13117− .ndo_poll_controller = poll_bnx2x,
13118−#endif
1311913103 .ndo_setup_tc = __bnx2x_setup_tc,
1312013104 #ifdef CONFIG_BNX2X_SRIOV
1312113105 .ndo_set_vf_mac = bnx2x_set_vf_mac,
drivers/net/ethernet/broadcom/bnxt/bnxt.c+7−20
@@ -7672,21 +7672,6 @@ static void bnxt_tx_timeout(struct net_device *dev) · 7671 unmodified lines
76727672 bnxt_queue_sp_work(bp);
76737673 }
76747674
7675−#ifdef CONFIG_NET_POLL_CONTROLLER
7676−static void bnxt_poll_controller(struct net_device *dev)
7677−{
7678− struct bnxt *bp = netdev_priv(dev);
7679− int i;
7680−
7681− /* Only process tx rings/combined rings in netpoll mode. */
7682− for (i = 0; i < bp->tx_nr_rings; i++) {
7683− struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
7684−
7685− napi_schedule(&txr->bnapi->napi);
7686− }
7687−}
7688−#endif
7689−
76907675 static void bnxt_timer(struct timer_list *t)
76917676 {
76927677 struct bnxt *bp = from_timer(bp, t, timer);
@@ -8027,7 +8012,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p) · 334 unmodified lines
80278012 if (ether_addr_equal(addr->sa_data, dev->dev_addr))
80288013 return 0;
80298014
8030− rc = bnxt_approve_mac(bp, addr->sa_data);
8015+ rc = bnxt_approve_mac(bp, addr->sa_data, true);
80318016 if (rc)
80328017 return rc;
80338018
@@ -8519,9 +8504,6 @@ static const struct net_device_ops bnxt_netdev_ops = { · 485 unmodified lines
85198504 .ndo_set_vf_link_state = bnxt_set_vf_link_state,
85208505 .ndo_set_vf_spoofchk = bnxt_set_vf_spoofchk,
85218506 .ndo_set_vf_trust = bnxt_set_vf_trust,
8522−#endif
8523−#ifdef CONFIG_NET_POLL_CONTROLLER
8524− .ndo_poll_controller = bnxt_poll_controller,
85258507 #endif
85268508 .ndo_setup_tc = bnxt_setup_tc,
85278509 #ifdef CONFIG_RFS_ACCEL
@@ -8827,14 +8809,19 @@ static int bnxt_init_mac_addr(struct bnxt *bp) · 299 unmodified lines
88278809 } else {
88288810 #ifdef CONFIG_BNXT_SRIOV
88298811 struct bnxt_vf_info *vf = &bp->vf;
8812+ bool strict_approval = true;
88308813
88318814 if (is_valid_ether_addr(vf->mac_addr)) {
88328815 /* overwrite netdev dev_addr with admin VF MAC */
88338816 memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
8817+ /* Older PF driver or firmware may not approve this
8818+ * correctly.
8819+ */
8820+ strict_approval = false;
88348821 } else {
88358822 eth_hw_addr_random(bp->dev);
88368823 }
8837− rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
8824+ rc = bnxt_approve_mac(bp, bp->dev->dev_addr, strict_approval);
88388825 #endif
88398826 }
88408827 return rc;
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c+3−0
@@ -46,6 +46,9 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, · 45 unmodified lines
4646 }
4747 }
4848
49+ if (i == ARRAY_SIZE(nvm_params))
50+ return -EOPNOTSUPP;
51+
4952 if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
5053 idx = bp->pf.port_id;
5154 else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c+5−4
@@ -1104,7 +1104,7 @@ update_vf_mac_exit: · 1103 unmodified lines
11041104 mutex_unlock(&bp->hwrm_cmd_lock);
11051105 }
11061106
1107−int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1107+int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11081108 {
11091109 struct hwrm_func_vf_cfg_input req = {0};
11101110 int rc = 0;
@@ -1122,12 +1122,13 @@ int bnxt_approve_mac(struct bnxt *bp, u8 *mac) · 11 unmodified lines
11221122 memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
11231123 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
11241124 mac_done:
1125− if (rc) {
1125+ if (rc && strict) {
11261126 rc = -EADDRNOTAVAIL;
11271127 netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n",
11281128 mac);
1129+ return rc;
11291130 }
1130− return rc;
1131+ return 0;
11311132 }
11321133 #else
11331134
@@ -1144,7 +1145,7 @@ void bnxt_update_vf_mac(struct bnxt *bp) · 10 unmodified lines
11441145 {
11451146 }
11461147
1147−int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
1148+int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
11481149 {
11491150 return 0;
11501151 }
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h+1−1
@@ -39,5 +39,5 @@ int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs); · 38 unmodified lines
3939 void bnxt_sriov_disable(struct bnxt *);
4040 void bnxt_hwrm_exec_fwd_req(struct bnxt *);
4141 void bnxt_update_vf_mac(struct bnxt *);
42−int bnxt_approve_mac(struct bnxt *, u8 *);
42+int bnxt_approve_mac(struct bnxt *, u8 *, bool);
4343 #endif
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c+14−6
@@ -75,17 +75,23 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, · 74 unmodified lines
7575 return 0;
7676 }
7777
78−static void bnxt_tc_parse_vlan(struct bnxt *bp,
79− struct bnxt_tc_actions *actions,
80− const struct tc_action *tc_act)
78+static int bnxt_tc_parse_vlan(struct bnxt *bp,
79+ struct bnxt_tc_actions *actions,
80+ const struct tc_action *tc_act)
8181 {
82− if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_POP) {
82+ switch (tcf_vlan_action(tc_act)) {
83+ case TCA_VLAN_ACT_POP:
8384 actions->flags |= BNXT_TC_ACTION_FLAG_POP_VLAN;
84− } else if (tcf_vlan_action(tc_act) == TCA_VLAN_ACT_PUSH) {
85+ break;
86+ case TCA_VLAN_ACT_PUSH:
8587 actions->flags |= BNXT_TC_ACTION_FLAG_PUSH_VLAN;
8688 actions->push_vlan_tci = htons(tcf_vlan_push_vid(tc_act));
8789 actions->push_vlan_tpid = tcf_vlan_push_proto(tc_act);
90+ break;
91+ default:
92+ return -EOPNOTSUPP;
8893 }
94+ return 0;
8995 }
9096
9197 static int bnxt_tc_parse_tunnel_set(struct bnxt *bp,
@@ -134,7 +140,9 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, · 42 unmodified lines
134140
135141 /* Push/pop VLAN */
136142 if (is_tcf_vlan(tc_act)) {
137− bnxt_tc_parse_vlan(bp, actions, tc_act);
143+ rc = bnxt_tc_parse_vlan(bp, actions, tc_act);
144+ if (rc)
145+ return rc;
138146 continue;
139147 }
140148
drivers/net/ethernet/cadence/macb_main.c+8−0
@@ -3837,6 +3837,13 @@ static const struct macb_config at91sam9260_config = { · 3836 unmodified lines
38373837 .init = macb_init,
38383838 };
38393839
3840+static const struct macb_config sama5d3macb_config = {
3841+ .caps = MACB_CAPS_SG_DISABLED
3842+ | MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
3843+ .clk_init = macb_clk_init,
3844+ .init = macb_init,
3845+};
3846+
38403847 static const struct macb_config pc302gem_config = {
38413848 .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
38423849 .dma_burst_length = 16,
@@ -3904,6 +3911,7 @@ static const struct of_device_id macb_dt_ids[] = { · 61 unmodified lines
39043911 { .compatible = "cdns,gem", .data = &pc302gem_config },
39053912 { .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config },
39063913 { .compatible = "atmel,sama5d3-gem", .data = &sama5d3_config },
3914+ { .compatible = "atmel,sama5d3-macb", .data = &sama5d3macb_config },
39073915 { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config },
39083916 { .compatible = "cdns,at91rm9200-emac", .data = &emac_config },
39093917 { .compatible = "cdns,emac", .data = &emac_config },
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h+0−1
@@ -753,7 +753,6 @@ struct cpl_abort_req_rss { · 752 unmodified lines
753753 };
754754
755755 struct cpl_abort_req_rss6 {
756− WR_HDR;
757756 union opcode_tid ot;
758757 __be32 srqidx_status;
759758 };
drivers/net/ethernet/cirrus/ep93xx_eth.c+1−1
@@ -332,7 +332,7 @@ static int ep93xx_poll(struct napi_struct *napi, int budget) · 331 unmodified lines
332332 return rx;
333333 }
334334
335−static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
335+static netdev_tx_t ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
336336 {
337337 struct ep93xx_priv *ep = netdev_priv(dev);
338338 struct ep93xx_tdesc *txd;
drivers/net/ethernet/cirrus/mac89x0.c+2−2
@@ -113,7 +113,7 @@ struct net_local { · 112 unmodified lines
113113
114114 /* Index to functions, as function prototypes. */
115115 static int net_open(struct net_device *dev);
116−static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
116+static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev);
117117 static irqreturn_t net_interrupt(int irq, void *dev_id);
118118 static void set_multicast_list(struct net_device *dev);
119119 static void net_rx(struct net_device *dev);
@@ -324,7 +324,7 @@ net_open(struct net_device *dev) · 204 unmodified lines
324324 return 0;
325325 }
326326
327−static int
327+static netdev_tx_t
328328 net_send_packet(struct sk_buff *skb, struct net_device *dev)
329329 {
330330 struct net_local *lp = netdev_priv(dev);
drivers/net/ethernet/emulex/benet/be_cmds.c+1−1
@@ -4500,7 +4500,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, · 4499 unmodified lines
45004500 port_res->max_vfs += le16_to_cpu(pcie->num_vfs);
45014501 }
45024502 }
4503− return status;
4503+ goto err;
45044504 }
45054505
45064506 pcie = be_get_pcie_desc(resp->func_param, desc_count,
drivers/net/ethernet/hp/hp100.c+1−1
@@ -2634,7 +2634,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin) · 2633 unmodified lines
26342634 /* Wait for link to drop */
26352635 time = jiffies + (HZ / 10);
26362636 do {
2637− if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
2637+ if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
26382638 break;
26392639 if (!in_interrupt())
26402640 schedule_timeout_interruptible(1);
drivers/net/ethernet/i825xx/ether1.c+3−2
@@ -64,7 +64,8 @@ static unsigned int net_debug = NET_DEBUG; · 63 unmodified lines
6464 #define RX_AREA_END 0x0fc00
6565
6666 static int ether1_open(struct net_device *dev);
67−static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
67+static netdev_tx_t ether1_sendpacket(struct sk_buff *skb,
68+ struct net_device *dev);
6869 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
6970 static int ether1_close(struct net_device *dev);
7071 static void ether1_setmulticastlist(struct net_device *dev);
@@ -667,7 +668,7 @@ ether1_timeout(struct net_device *dev) · 596 unmodified lines
667668 netif_wake_queue(dev);
668669 }
669670
670−static int
671+static netdev_tx_t
671672 ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
672673 {
673674 int tmp, tst, nopaddr, txaddr, tbdaddr, dataddr;
drivers/net/ethernet/i825xx/lib82596.c+2−2
@@ -347,7 +347,7 @@ static const char init_setup[] = · 346 unmodified lines
347347 0x7f /* *multi IA */ };
348348
349349 static int i596_open(struct net_device *dev);
350−static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
350+static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
351351 static irqreturn_t i596_interrupt(int irq, void *dev_id);
352352 static int i596_close(struct net_device *dev);
353353 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
@@ -966,7 +966,7 @@ static void i596_tx_timeout (struct net_device *dev) · 612 unmodified lines
966966 }
967967
968968
969−static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
969+static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
970970 {
971971 struct i596_private *lp = netdev_priv(dev);
972972 struct tx_cmd *tx_cmd;
drivers/net/ethernet/i825xx/sun3_82586.c+4−2
@@ -121,7 +121,8 @@ static int sun3_82586_probe1(struct net_device *dev,int ioaddr); · 120 unmodified lines
121121 static irqreturn_t sun3_82586_interrupt(int irq,void *dev_id);
122122 static int sun3_82586_open(struct net_device *dev);
123123 static int sun3_82586_close(struct net_device *dev);
124−static int sun3_82586_send_packet(struct sk_buff *,struct net_device *);
124+static netdev_tx_t sun3_82586_send_packet(struct sk_buff *,
125+ struct net_device *);
125126 static struct net_device_stats *sun3_82586_get_stats(struct net_device *dev);
126127 static void set_multicast_list(struct net_device *dev);
127128 static void sun3_82586_timeout(struct net_device *dev);
@@ -1002,7 +1003,8 @@ static void sun3_82586_timeout(struct net_device *dev) · 874 unmodified lines
10021003 * send frame
10031004 */
10041005
1005−static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
1006+static netdev_tx_t
1007+sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
10061008 {
10071009 int len,i;
10081010 #ifndef NO_NOPCOMMANDS
drivers/net/ethernet/ibm/emac/core.c+10−5
@@ -2677,12 +2677,17 @@ static int emac_init_phy(struct emac_instance *dev) · 2676 unmodified lines
26772677 if (of_phy_is_fixed_link(np)) {
26782678 int res = emac_dt_mdio_probe(dev);
26792679
2680− if (!res) {
2681− res = of_phy_register_fixed_link(np);
2682− if (res)
2683− mdiobus_unregister(dev->mii_bus);
2680+ if (res)
2681+ return res;
2682+
2683+ res = of_phy_register_fixed_link(np);
2684+ dev->phy_dev = of_phy_find_device(np);
2685+ if (res || !dev->phy_dev) {
2686+ mdiobus_unregister(dev->mii_bus);
2687+ return res ? res : -EINVAL;
26842688 }
2685− return res;
2689+ emac_adjust_link(dev->ndev);
2690+ put_device(&dev->phy_dev->mdio.dev);
26862691 }
26872692 return 0;
26882693 }
drivers/net/ethernet/intel/fm10k/fm10k.h+0−3
@@ -504,9 +504,6 @@ void fm10k_update_stats(struct fm10k_intfc *interface); · 503 unmodified lines
504504 void fm10k_service_event_schedule(struct fm10k_intfc *interface);
505505 void fm10k_macvlan_schedule(struct fm10k_intfc *interface);
506506 void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);
507−#ifdef CONFIG_NET_POLL_CONTROLLER
508−void fm10k_netpoll(struct net_device *netdev);
509−#endif
510507
511508 /* Netdev */
512509 struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info);
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c+0−3
@@ -1648,9 +1648,6 @@ static const struct net_device_ops fm10k_netdev_ops = { · 1647 unmodified lines
16481648 .ndo_udp_tunnel_del = fm10k_udp_tunnel_del,
16491649 .ndo_dfwd_add_station = fm10k_dfwd_add_station,
16501650 .ndo_dfwd_del_station = fm10k_dfwd_del_station,
1651−#ifdef CONFIG_NET_POLL_CONTROLLER
1652− .ndo_poll_controller = fm10k_netpoll,
1653−#endif
16541651 .ndo_features_check = fm10k_features_check,
16551652 };
16561653
drivers/net/ethernet/intel/fm10k/fm10k_pci.c+0−22
@@ -1210,28 +1210,6 @@ static irqreturn_t fm10k_msix_mbx_vf(int __always_unused irq, void *data) · 1209 unmodified lines
12101210 return IRQ_HANDLED;
12111211 }
12121212
1213−#ifdef CONFIG_NET_POLL_CONTROLLER
1214−/**
1215− * fm10k_netpoll - A Polling 'interrupt' handler
1216− * @netdev: network interface device structure
1217− *
1218− * This is used by netconsole to send skbs without having to re-enable
1219− * interrupts. It's not called while the normal interrupt routine is executing.
1220− **/
1221−void fm10k_netpoll(struct net_device *netdev)
1222−{
1223− struct fm10k_intfc *interface = netdev_priv(netdev);
1224− int i;
1225−
1226− /* if interface is down do nothing */
1227− if (test_bit(__FM10K_DOWN, interface->state))
1228− return;
1229−
1230− for (i = 0; i < interface->num_q_vectors; i++)
1231− fm10k_msix_clean_rings(0, interface->q_vector[i]);
1232−}
1233−
1234−#endif
12351213 #define FM10K_ERR_MSG(type) case (type): error = #type; break
12361214 static void fm10k_handle_fault(struct fm10k_intfc *interface, int type,
12371215 struct fm10k_fault *fault)
drivers/net/ethernet/intel/i40evf/i40evf_main.c+0−26
@@ -396,29 +396,6 @@ static void i40evf_map_rings_to_vectors(struct i40evf_adapter *adapter) · 395 unmodified lines
396396 adapter->aq_required |= I40EVF_FLAG_AQ_MAP_VECTORS;
397397 }
398398
399−#ifdef CONFIG_NET_POLL_CONTROLLER
400−/**
401− * i40evf_netpoll - A Polling 'interrupt' handler
402− * @netdev: network interface device structure
403− *
404− * This is used by netconsole to send skbs without having to re-enable
405− * interrupts. It's not called while the normal interrupt routine is executing.
406− **/
407−static void i40evf_netpoll(struct net_device *netdev)
408−{
409− struct i40evf_adapter *adapter = netdev_priv(netdev);
410− int q_vectors = adapter->num_msix_vectors - NONQ_VECS;
411− int i;
412−
413− /* if interface is down do nothing */
414− if (test_bit(__I40E_VSI_DOWN, adapter->vsi.state))
415− return;
416−
417− for (i = 0; i < q_vectors; i++)
418− i40evf_msix_clean_rings(0, &adapter->q_vectors[i]);
419−}
420−
421−#endif
422399 /**
423400 * i40evf_irq_affinity_notify - Callback for affinity changes
424401 * @notify: context as to what irq was changed
@@ -3229,9 +3206,6 @@ static const struct net_device_ops i40evf_netdev_ops = { · 2804 unmodified lines
32293206 .ndo_features_check = i40evf_features_check,
32303207 .ndo_fix_features = i40evf_fix_features,
32313208 .ndo_set_features = i40evf_set_features,
3232−#ifdef CONFIG_NET_POLL_CONTROLLER
3233− .ndo_poll_controller = i40evf_netpoll,
3234−#endif
32353209 .ndo_setup_tc = i40evf_setup_tc,
32363210 };
32373211
drivers/net/ethernet/intel/ice/ice_main.c+0−27
@@ -4806,30 +4806,6 @@ void ice_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) · 4805 unmodified lines
48064806 stats->rx_length_errors = vsi_stats->rx_length_errors;
48074807 }
48084808
4809−#ifdef CONFIG_NET_POLL_CONTROLLER
4810−/**
4811− * ice_netpoll - polling "interrupt" handler
4812− * @netdev: network interface device structure
4813− *
4814− * Used by netconsole to send skbs without having to re-enable interrupts.
4815− * This is not called in the normal interrupt path.
4816− */
4817−static void ice_netpoll(struct net_device *netdev)
4818−{
4819− struct ice_netdev_priv *np = netdev_priv(netdev);
4820− struct ice_vsi *vsi = np->vsi;
4821− struct ice_pf *pf = vsi->back;
4822− int i;
4823−
4824− if (test_bit(__ICE_DOWN, vsi->state) ||
4825− !test_bit(ICE_FLAG_MSIX_ENA, pf->flags))
4826− return;
4827−
4828− for (i = 0; i < vsi->num_q_vectors; i++)
4829− ice_msix_clean_rings(0, vsi->q_vectors[i]);
4830−}
4831−#endif /* CONFIG_NET_POLL_CONTROLLER */
4832−
48334809 /**
48344810 * ice_napi_disable_all - Disable NAPI for all q_vectors in the VSI
48354811 * @vsi: VSI having NAPI disabled
@@ -5497,9 +5473,6 @@ static const struct net_device_ops ice_netdev_ops = { · 661 unmodified lines
54975473 .ndo_validate_addr = eth_validate_addr,
54985474 .ndo_change_mtu = ice_change_mtu,
54995475 .ndo_get_stats64 = ice_get_stats64,
5500−#ifdef CONFIG_NET_POLL_CONTROLLER
5501− .ndo_poll_controller = ice_netpoll,
5502−#endif /* CONFIG_NET_POLL_CONTROLLER */
55035476 .ndo_vlan_rx_add_vid = ice_vlan_rx_add_vid,
55045477 .ndo_vlan_rx_kill_vid = ice_vlan_rx_kill_vid,
55055478 .ndo_set_features = ice_set_features,
drivers/net/ethernet/intel/igb/igb_main.c+0−30
@@ -205,10 +205,6 @@ static struct notifier_block dca_notifier = { · 204 unmodified lines
205205 .priority = 0
206206 };
207207 #endif
208−#ifdef CONFIG_NET_POLL_CONTROLLER
209−/* for netdump / net console */
210−static void igb_netpoll(struct net_device *);
211−#endif
212208 #ifdef CONFIG_PCI_IOV
213209 static unsigned int max_vfs;
214210 module_param(max_vfs, uint, 0);
@@ -2881,9 +2877,6 @@ static const struct net_device_ops igb_netdev_ops = { · 2666 unmodified lines
28812877 .ndo_set_vf_spoofchk = igb_ndo_set_vf_spoofchk,
28822878 .ndo_set_vf_trust = igb_ndo_set_vf_trust,
28832879 .ndo_get_vf_config = igb_ndo_get_vf_config,
2884−#ifdef CONFIG_NET_POLL_CONTROLLER
2885− .ndo_poll_controller = igb_netpoll,
2886−#endif
28872880 .ndo_fix_features = igb_fix_features,
28882881 .ndo_set_features = igb_set_features,
28892882 .ndo_fdb_add = igb_ndo_fdb_add,
@@ -9053,29 +9046,6 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs) · 6163 unmodified lines
90539046 return 0;
90549047 }
90559048
9056−#ifdef CONFIG_NET_POLL_CONTROLLER
9057−/* Polling 'interrupt' - used by things like netconsole to send skbs
9058− * without having to re-enable interrupts. It's not called while
9059− * the interrupt routine is executing.
9060− */
9061−static void igb_netpoll(struct net_device *netdev)
9062−{
9063− struct igb_adapter *adapter = netdev_priv(netdev);
9064− struct e1000_hw *hw = &adapter->hw;
9065− struct igb_q_vector *q_vector;
9066− int i;
9067−
9068− for (i = 0; i < adapter->num_q_vectors; i++) {
9069− q_vector = adapter->q_vector[i];
9070− if (adapter->flags & IGB_FLAG_HAS_MSIX)
9071− wr32(E1000_EIMC, q_vector->eims_value);
9072− else
9073− igb_irq_disable(adapter);
9074− napi_schedule(&q_vector->napi);
9075− }
9076−}
9077−#endif /* CONFIG_NET_POLL_CONTROLLER */
9078−
90799049 /**
90809050 * igb_io_error_detected - called when PCI error is detected
90819051 * @pdev: Pointer to PCI device
drivers/net/ethernet/intel/ixgb/ixgb_main.c+0−25
@@ -81,11 +81,6 @@ static int ixgb_vlan_rx_kill_vid(struct net_device *netdev, · 80 unmodified lines
8181 __be16 proto, u16 vid);
8282 static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
8383
84−#ifdef CONFIG_NET_POLL_CONTROLLER
85−/* for netdump / net console */
86−static void ixgb_netpoll(struct net_device *dev);
87−#endif
88−
8984 static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
9085 enum pci_channel_state state);
9186 static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
@@ -348,9 +343,6 @@ static const struct net_device_ops ixgb_netdev_ops = { · 256 unmodified lines
348343 .ndo_tx_timeout = ixgb_tx_timeout,
349344 .ndo_vlan_rx_add_vid = ixgb_vlan_rx_add_vid,
350345 .ndo_vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid,
351−#ifdef CONFIG_NET_POLL_CONTROLLER
352− .ndo_poll_controller = ixgb_netpoll,
353−#endif
354346 .ndo_fix_features = ixgb_fix_features,
355347 .ndo_set_features = ixgb_set_features,
356348 };
@@ -2195,23 +2187,6 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter) · 1838 unmodified lines
21952187 ixgb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
21962188 }
21972189
2198−#ifdef CONFIG_NET_POLL_CONTROLLER
2199−/*
2200− * Polling 'interrupt' - used by things like netconsole to send skbs
2201− * without having to re-enable interrupts. It's not called while
2202− * the interrupt routine is executing.
2203− */
2204−
2205−static void ixgb_netpoll(struct net_device *dev)
2206−{
2207− struct ixgb_adapter *adapter = netdev_priv(dev);
2208−
2209− disable_irq(adapter->pdev->irq);
2210− ixgb_intr(adapter->pdev->irq, dev);
2211− enable_irq(adapter->pdev->irq);
2212−}
2213−#endif
2214−
22152190 /**
22162191 * ixgb_io_error_detected - called when PCI error is detected
22172192 * @pdev: pointer to pci device with error
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+0−25
@@ -8768,28 +8768,6 @@ static int ixgbe_del_sanmac_netdev(struct net_device *dev) · 8767 unmodified lines
87688768 return err;
87698769 }
87708770
8771−#ifdef CONFIG_NET_POLL_CONTROLLER
8772−/*
8773− * Polling 'interrupt' - used by things like netconsole to send skbs
8774− * without having to re-enable interrupts. It's not called while
8775− * the interrupt routine is executing.
8776− */
8777−static void ixgbe_netpoll(struct net_device *netdev)
8778−{
8779− struct ixgbe_adapter *adapter = netdev_priv(netdev);
8780− int i;
8781−
8782− /* if interface is down do nothing */
8783− if (test_bit(__IXGBE_DOWN, &adapter->state))
8784− return;
8785−
8786− /* loop through and schedule all active queues */
8787− for (i = 0; i < adapter->num_q_vectors; i++)
8788− ixgbe_msix_clean_rings(0, adapter->q_vector[i]);
8789−}
8790−
8791−#endif
8792−
87938771 static void ixgbe_get_ring_stats64(struct rtnl_link_stats64 *stats,
87948772 struct ixgbe_ring *ring)
87958773 {
@@ -10251,9 +10229,6 @@ static const struct net_device_ops ixgbe_netdev_ops = { · 1455 unmodified lines
1025110229 .ndo_get_vf_config = ixgbe_ndo_get_vf_config,
1025210230 .ndo_get_stats64 = ixgbe_get_stats64,
1025310231 .ndo_setup_tc = __ixgbe_setup_tc,
10254−#ifdef CONFIG_NET_POLL_CONTROLLER
10255− .ndo_poll_controller = ixgbe_netpoll,
10256−#endif
1025710232 #ifdef IXGBE_FCOE
1025810233 .ndo_select_queue = ixgbe_select_queue,
1025910234 .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get,
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+0−21
@@ -4233,24 +4233,6 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu) · 4232 unmodified lines
42334233 return 0;
42344234 }
42354235
4236−#ifdef CONFIG_NET_POLL_CONTROLLER
4237−/* Polling 'interrupt' - used by things like netconsole to send skbs
4238− * without having to re-enable interrupts. It's not called while
4239− * the interrupt routine is executing.
4240− */
4241−static void ixgbevf_netpoll(struct net_device *netdev)
4242−{
4243− struct ixgbevf_adapter *adapter = netdev_priv(netdev);
4244− int i;
4245−
4246− /* if interface is down do nothing */
4247− if (test_bit(__IXGBEVF_DOWN, &adapter->state))
4248− return;
4249− for (i = 0; i < adapter->num_rx_queues; i++)
4250− ixgbevf_msix_clean_rings(0, adapter->q_vector[i]);
4251−}
4252−#endif /* CONFIG_NET_POLL_CONTROLLER */
4253−
42544236 static int ixgbevf_suspend(struct pci_dev *pdev, pm_message_t state)
42554237 {
42564238 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4482,9 +4464,6 @@ static const struct net_device_ops ixgbevf_netdev_ops = { · 225 unmodified lines
44824464 .ndo_tx_timeout = ixgbevf_tx_timeout,
44834465 .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid,
44844466 .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid,
4485−#ifdef CONFIG_NET_POLL_CONTROLLER
4486− .ndo_poll_controller = ixgbevf_netpoll,
4487−#endif
44884467 .ndo_features_check = ixgbevf_features_check,
44894468 .ndo_bpf = ixgbevf_xdp,
44904469 };
drivers/net/ethernet/lantiq_etop.c+1−0
@@ -274,6 +274,7 @@ ltq_etop_hw_init(struct net_device *dev) · 273 unmodified lines
274274 struct ltq_etop_chan *ch = &priv->ch[i];
275275
276276 ch->idx = ch->dma.nr = i;
277+ ch->dma.dev = &priv->pdev->dev;
277278
278279 if (IS_TX(i)) {
279280 ltq_dma_alloc_tx(&ch->dma);
drivers/net/ethernet/marvell/mvneta.c+6−7
@@ -1890,8 +1890,8 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp, · 1889 unmodified lines
18901890 if (!data || !(rx_desc->buf_phys_addr))
18911891 continue;
18921892
1893− dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
1894− MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
1893+ dma_unmap_page(pp->dev->dev.parent, rx_desc->buf_phys_addr,
1894+ PAGE_SIZE, DMA_FROM_DEVICE);
18951895 __free_page(data);
18961896 }
18971897 }
@@ -2008,8 +2008,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi, · 110 unmodified lines
20082008 skb_add_rx_frag(rxq->skb, frag_num, page,
20092009 frag_offset, frag_size,
20102010 PAGE_SIZE);
2011− dma_unmap_single(dev->dev.parent, phys_addr,
2012− PAGE_SIZE, DMA_FROM_DEVICE);
2011+ dma_unmap_page(dev->dev.parent, phys_addr,
2012+ PAGE_SIZE, DMA_FROM_DEVICE);
20132013 rxq->left_size -= frag_size;
20142014 }
20152015 } else {
@@ -2039,9 +2039,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi, · 23 unmodified lines
20392039 frag_offset, frag_size,
20402040 PAGE_SIZE);
20412041
2042− dma_unmap_single(dev->dev.parent, phys_addr,
2043− PAGE_SIZE,
2044− DMA_FROM_DEVICE);
2042+ dma_unmap_page(dev->dev.parent, phys_addr,
2043+ PAGE_SIZE, DMA_FROM_DEVICE);
20452044
20462045 rxq->left_size -= frag_size;
20472046 }
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+12−19
@@ -58,6 +58,8 @@ static struct { · 57 unmodified lines
5858 */
5959 static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
6060 const struct phylink_link_state *state);
61+static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode,
62+ phy_interface_t interface, struct phy_device *phy);
6163
6264 /* Queue modes */
6365 #define MVPP2_QDIST_SINGLE_MODE 0
@@ -3053,10 +3055,12 @@ static int mvpp2_poll(struct napi_struct *napi, int budget) · 2989 unmodified lines
30533055 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK);
30543056 }
30553057
3056− cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;
3057− if (cause_tx) {
3058− cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET;
3059− mvpp2_tx_done(port, cause_tx, qv->sw_thread_id);
3058+ if (port->has_tx_irqs) {
3059+ cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;
3060+ if (cause_tx) {
3061+ cause_tx >>= MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_OFFSET;
3062+ mvpp2_tx_done(port, cause_tx, qv->sw_thread_id);
3063+ }
30603064 }
30613065
30623066 /* Process RX packets */
@@ -3142,6 +3146,7 @@ static void mvpp2_start_dev(struct mvpp2_port *port) · 79 unmodified lines
31423146 mvpp22_mode_reconfigure(port);
31433147
31443148 if (port->phylink) {
3149+ netif_carrier_off(port->dev);
31453150 phylink_start(port->phylink);
31463151 } else {
31473152 /* Phylink isn't used as of now for ACPI, so the MAC has to be
@@ -3150,9 +3155,10 @@ static void mvpp2_start_dev(struct mvpp2_port *port) · 2 unmodified lines
31503155 */
31513156 struct phylink_link_state state = {
31523157 .interface = port->phy_interface,
3153− .link = 1,
31543158 };
31553159 mvpp2_mac_config(port->dev, MLO_AN_INBAND, &state);
3160+ mvpp2_mac_link_up(port->dev, MLO_AN_INBAND, port->phy_interface,
3161+ NULL);
31563162 }
31573163
31583164 netif_tx_start_all_queues(port->dev);
@@ -4495,10 +4501,6 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode, · 1336 unmodified lines
44954501 return;
44964502 }
44974503
4498− netif_tx_stop_all_queues(port->dev);
4499− if (!port->has_phy)
4500− netif_carrier_off(port->dev);
4501−
45024504 /* Make sure the port is disabled when reconfiguring the mode */
45034505 mvpp2_port_disable(port);
45044506
@@ -4523,16 +4525,7 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode, · 18 unmodified lines
45234525 if (port->priv->hw_version == MVPP21 && port->flags & MVPP2_F_LOOPBACK)
45244526 mvpp2_port_loopback_set(port, state);
45254527
4526− /* If the port already was up, make sure it's still in the same state */
4527− if (state->link || !port->has_phy) {
4528− mvpp2_port_enable(port);
4529−
4530− mvpp2_egress_enable(port);
4531− mvpp2_ingress_enable(port);
4532− if (!port->has_phy)
4533− netif_carrier_on(dev);
4534− netif_tx_wake_all_queues(dev);
4535− }
4528+ mvpp2_port_enable(port);
45364529 }
45374530
45384531 static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode,
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+0−20
@@ -1286,20 +1286,6 @@ out: · 1285 unmodified lines
12861286 mutex_unlock(&mdev->state_lock);
12871287 }
12881288
1289−#ifdef CONFIG_NET_POLL_CONTROLLER
1290−static void mlx4_en_netpoll(struct net_device *dev)
1291−{
1292− struct mlx4_en_priv *priv = netdev_priv(dev);
1293− struct mlx4_en_cq *cq;
1294− int i;
1295−
1296− for (i = 0; i < priv->tx_ring_num[TX]; i++) {
1297− cq = priv->tx_cq[TX][i];
1298− napi_schedule(&cq->napi);
1299− }
1300−}
1301−#endif
1302−
13031289 static int mlx4_en_set_rss_steer_rules(struct mlx4_en_priv *priv)
13041290 {
13051291 u64 reg_id;
@@ -2946,9 +2932,6 @@ static const struct net_device_ops mlx4_netdev_ops = { · 1640 unmodified lines
29462932 .ndo_tx_timeout = mlx4_en_tx_timeout,
29472933 .ndo_vlan_rx_add_vid = mlx4_en_vlan_rx_add_vid,
29482934 .ndo_vlan_rx_kill_vid = mlx4_en_vlan_rx_kill_vid,
2949−#ifdef CONFIG_NET_POLL_CONTROLLER
2950− .ndo_poll_controller = mlx4_en_netpoll,
2951−#endif
29522935 .ndo_set_features = mlx4_en_set_features,
29532936 .ndo_fix_features = mlx4_en_fix_features,
29542937 .ndo_setup_tc = __mlx4_en_setup_tc,
@@ -2983,9 +2966,6 @@ static const struct net_device_ops mlx4_netdev_ops_master = { · 28 unmodified lines
29832966 .ndo_set_vf_link_state = mlx4_en_set_vf_link_state,
29842967 .ndo_get_vf_stats = mlx4_en_get_vf_stats,
29852968 .ndo_get_vf_config = mlx4_en_get_vf_config,
2986−#ifdef CONFIG_NET_POLL_CONTROLLER
2987− .ndo_poll_controller = mlx4_en_netpoll,
2988−#endif
29892969 .ndo_set_features = mlx4_en_set_features,
29902970 .ndo_fix_features = mlx4_en_fix_features,
29912971 .ndo_setup_tc = __mlx4_en_setup_tc,
drivers/net/ethernet/mellanox/mlx4/eq.c+2−1
@@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec) · 239 unmodified lines
240240 struct mlx4_dev *dev = &priv->dev;
241241 struct mlx4_eq *eq = &priv->eq_table.eq[vec];
242242
243− if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
243+ if (!cpumask_available(eq->affinity_mask) ||
244+ cpumask_empty(eq->affinity_mask))
244245 return;
245246
246247 hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+1−1
@@ -206,7 +206,7 @@ static void poll_timeout(struct mlx5_cmd_work_ent *ent) · 205 unmodified lines
206206 u8 own;
207207
208208 do {
209− own = ent->lay->status_own;
209+ own = READ_ONCE(ent->lay->status_own);
210210 if (!(own & CMD_OWNER_HW)) {
211211 ent->ret = 0;
212212 return;
drivers/net/ethernet/mellanox/mlx5/core/dev.c+14−8
@@ -132,11 +132,11 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) · 131 unmodified lines
132132 delayed_event_start(priv);
133133
134134 dev_ctx->context = intf->add(dev);
135− set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
136− if (intf->attach)
137− set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
138−
139135 if (dev_ctx->context) {
136+ set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
137+ if (intf->attach)
138+ set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
139+
140140 spin_lock_irq(&priv->ctx_lock);
141141 list_add_tail(&dev_ctx->list, &priv->ctx_list);
142142
@@ -211,12 +211,17 @@ static void mlx5_attach_interface(struct mlx5_interface *intf, struct mlx5_priv · 68 unmodified lines
211211 if (intf->attach) {
212212 if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state))
213213 goto out;
214− intf->attach(dev, dev_ctx->context);
214+ if (intf->attach(dev, dev_ctx->context))
215+ goto out;
216+
215217 set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
216218 } else {
217219 if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state))
218220 goto out;
219221 dev_ctx->context = intf->add(dev);
222+ if (!dev_ctx->context)
223+ goto out;
224+
220225 set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
221226 }
222227
@@ -391,16 +396,17 @@ void mlx5_remove_dev_by_protocol(struct mlx5_core_dev *dev, int protocol) · 168 unmodified lines
391396 }
392397 }
393398
394−static u16 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
399+static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
395400 {
396− return (u16)((dev->pdev->bus->number << 8) |
401+ return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
402+ (dev->pdev->bus->number << 8) |
397403 PCI_SLOT(dev->pdev->devfn));
398404 }
399405
400406 /* Must be called with intf_mutex held */
401407 struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
402408 {
403− u16 pci_id = mlx5_gen_pci_id(dev);
409+ u32 pci_id = mlx5_gen_pci_id(dev);
404410 struct mlx5_core_dev *res = NULL;
405411 struct mlx5_core_dev *tmp_dev;
406412 struct mlx5_priv *priv;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c+2−1
@@ -183,12 +183,13 @@ static const struct tlsdev_ops mlx5e_tls_ops = { · 182 unmodified lines
183183
184184 void mlx5e_tls_build_netdev(struct mlx5e_priv *priv)
185185 {
186− u32 caps = mlx5_accel_tls_device_caps(priv->mdev);
187186 struct net_device *netdev = priv->netdev;
187+ u32 caps;
188188
189189 if (!mlx5_accel_is_tls_device(priv->mdev))
190190 return;
191191
192+ caps = mlx5_accel_tls_device_caps(priv->mdev);
192193 if (caps & MLX5_ACCEL_TLS_TX) {
193194 netdev->features |= NETIF_F_HW_TLS_TX;
194195 netdev->hw_features |= NETIF_F_HW_TLS_TX;
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c+1−1
@@ -191,7 +191,7 @@ set_udp(void *headers_c, void *headers_v, __be16 psrc_m, __be16 psrc_v, · 190 unmodified lines
191191 {
192192 if (psrc_m) {
193193 MLX5E_FTE_SET(headers_c, udp_sport, 0xffff);
194− MLX5E_FTE_SET(headers_c, udp_sport, ntohs(psrc_v));
194+ MLX5E_FTE_SET(headers_v, udp_sport, ntohs(psrc_v));
195195 }
196196
197197 if (pdst_m) {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+0−19
@@ -4315,22 +4315,6 @@ static int mlx5e_xdp(struct net_device *dev, struct netdev_bpf *xdp) · 4314 unmodified lines
43154315 }
43164316 }
43174317
4318−#ifdef CONFIG_NET_POLL_CONTROLLER
4319−/* Fake "interrupt" called by netpoll (eg netconsole) to send skbs without
4320− * reenabling interrupts.
4321− */
4322−static void mlx5e_netpoll(struct net_device *dev)
4323−{
4324− struct mlx5e_priv *priv = netdev_priv(dev);
4325− struct mlx5e_channels *chs = &priv->channels;
4326−
4327− int i;
4328−
4329− for (i = 0; i < chs->num; i++)
4330− napi_schedule(&chs->c[i]->napi);
4331−}
4332−#endif
4333−
43344318 static const struct net_device_ops mlx5e_netdev_ops = {
43354319 .ndo_open = mlx5e_open,
43364320 .ndo_stop = mlx5e_close,
@@ -4356,9 +4340,6 @@ static const struct net_device_ops mlx5e_netdev_ops = { · 19 unmodified lines
43564340 #ifdef CONFIG_MLX5_EN_ARFS
43574341 .ndo_rx_flow_steer = mlx5e_rx_flow_steer,
43584342 #endif
4359−#ifdef CONFIG_NET_POLL_CONTROLLER
4360− .ndo_poll_controller = mlx5e_netpoll,
4361−#endif
43624343 #ifdef CONFIG_MLX5_ESWITCH
43634344 /* SRIOV E-Switch NDOs */
43644345 .ndo_set_vf_mac = mlx5e_set_vf_mac,
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+1−0
@@ -663,6 +663,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports) · 662 unmodified lines
663663 if (err)
664664 goto miss_rule_err;
665665
666+ kvfree(flow_group_in);
666667 return 0;
667668
668669 miss_rule_err:
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+39−37
@@ -1578,6 +1578,33 @@ static u64 matched_fgs_get_version(struct list_head *match_head) · 1577 unmodified lines
15781578 return version;
15791579 }
15801580
1581+static struct fs_fte *
1582+lookup_fte_locked(struct mlx5_flow_group *g,
1583+ u32 *match_value,
1584+ bool take_write)
1585+{
1586+ struct fs_fte *fte_tmp;
1587+
1588+ if (take_write)
1589+ nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
1590+ else
1591+ nested_down_read_ref_node(&g->node, FS_LOCK_PARENT);
1592+ fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value,
1593+ rhash_fte);
1594+ if (!fte_tmp || !tree_get_node(&fte_tmp->node)) {
1595+ fte_tmp = NULL;
1596+ goto out;
1597+ }
1598+
1599+ nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
1600+out:
1601+ if (take_write)
1602+ up_write_ref_node(&g->node);
1603+ else
1604+ up_read_ref_node(&g->node);
1605+ return fte_tmp;
1606+}
1607+
15811608 static struct mlx5_flow_handle *
15821609 try_add_to_existing_fg(struct mlx5_flow_table *ft,
15831610 struct list_head *match_head,
@@ -1600,10 +1627,6 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft, · 16 unmodified lines
16001627 if (IS_ERR(fte))
16011628 return ERR_PTR(-ENOMEM);
16021629
1603− list_for_each_entry(iter, match_head, list) {
1604− nested_down_read_ref_node(&iter->g->node, FS_LOCK_PARENT);
1605− }
1606−
16071630 search_again_locked:
16081631 version = matched_fgs_get_version(match_head);
16091632 /* Try to find a fg that already contains a matching fte */
@@ -1611,20 +1634,9 @@ search_again_locked: · 1 unmodified line
16111634 struct fs_fte *fte_tmp;
16121635
16131636 g = iter->g;
1614− fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, spec->match_value,
1615− rhash_fte);
1616− if (!fte_tmp || !tree_get_node(&fte_tmp->node))
1637+ fte_tmp = lookup_fte_locked(g, spec->match_value, take_write);
1638+ if (!fte_tmp)
16171639 continue;
1618−
1619− nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
1620− if (!take_write) {
1621− list_for_each_entry(iter, match_head, list)
1622− up_read_ref_node(&iter->g->node);
1623− } else {
1624− list_for_each_entry(iter, match_head, list)
1625− up_write_ref_node(&iter->g->node);
1626− }
1627−
16281640 rule = add_rule_fg(g, spec->match_value,
16291641 flow_act, dest, dest_num, fte_tmp);
16301642 up_write_ref_node(&fte_tmp->node);
@@ -1633,19 +1645,6 @@ search_again_locked: · 2 unmodified lines
16331645 return rule;
16341646 }
16351647
1636− /* No group with matching fte found. Try to add a new fte to any
1637− * matching fg.
1638− */
1639−
1640− if (!take_write) {
1641− list_for_each_entry(iter, match_head, list)
1642− up_read_ref_node(&iter->g->node);
1643− list_for_each_entry(iter, match_head, list)
1644− nested_down_write_ref_node(&iter->g->node,
1645− FS_LOCK_PARENT);
1646− take_write = true;
1647− }
1648−
16491648 /* Check the ft version, for case that new flow group
16501649 * was added while the fgs weren't locked
16511650 */
@@ -1657,27 +1656,30 @@ search_again_locked: · 5 unmodified lines
16571656 /* Check the fgs version, for case the new FTE with the
16581657 * same values was added while the fgs weren't locked
16591658 */
1660− if (version != matched_fgs_get_version(match_head))
1659+ if (version != matched_fgs_get_version(match_head)) {
1660+ take_write = true;
16611661 goto search_again_locked;
1662+ }
16621663
16631664 list_for_each_entry(iter, match_head, list) {
16641665 g = iter->g;
16651666
16661667 if (!g->node.active)
16671668 continue;
1669+
1670+ nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
1671+
16681672 err = insert_fte(g, fte);
16691673 if (err) {
1674+ up_write_ref_node(&g->node);
16701675 if (err == -ENOSPC)
16711676 continue;
1672− list_for_each_entry(iter, match_head, list)
1673− up_write_ref_node(&iter->g->node);
16741677 kmem_cache_free(steering->ftes_cache, fte);
16751678 return ERR_PTR(err);
16761679 }
16771680
16781681 nested_down_write_ref_node(&fte->node, FS_LOCK_CHILD);
1679− list_for_each_entry(iter, match_head, list)
1680− up_write_ref_node(&iter->g->node);
1682+ up_write_ref_node(&g->node);
16811683 rule = add_rule_fg(g, spec->match_value,
16821684 flow_act, dest, dest_num, fte);
16831685 up_write_ref_node(&fte->node);
@@ -1686,8 +1688,6 @@ search_again_locked: · 2 unmodified lines
16861688 }
16871689 rule = ERR_PTR(-ENOENT);
16881690 out:
1689− list_for_each_entry(iter, match_head, list)
1690− up_write_ref_node(&iter->g->node);
16911691 kmem_cache_free(steering->ftes_cache, fte);
16921692 return rule;
16931693 }
@@ -1726,6 +1726,8 @@ search_again_locked: · 32 unmodified lines
17261726 if (err) {
17271727 if (take_write)
17281728 up_write_ref_node(&ft->node);
1729+ else
1730+ up_read_ref_node(&ft->node);
17291731 return ERR_PTR(err);
17301732 }
17311733
drivers/net/ethernet/mellanox/mlx5/core/health.c+9−1
@@ -331,9 +331,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) · 330 unmodified lines
331331 add_timer(&health->timer);
332332 }
333333
334−void mlx5_stop_health_poll(struct mlx5_core_dev *dev)
334+void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health)
335335 {
336336 struct mlx5_core_health *health = &dev->priv.health;
337+ unsigned long flags;
338+
339+ if (disable_health) {
340+ spin_lock_irqsave(&health->wq_lock, flags);
341+ set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags);
342+ set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags);
343+ spin_unlock_irqrestore(&health->wq_lock, flags);
344+ }
337345
338346 del_timer_sync(&health->timer);
339347 }
drivers/net/ethernet/mellanox/mlx5/core/main.c+7−5
@@ -878,8 +878,10 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 877 unmodified lines
878878 priv->numa_node = dev_to_node(&dev->pdev->dev);
879879
880880 priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root);
881− if (!priv->dbg_root)
881+ if (!priv->dbg_root) {
882+ dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n");
882883 return -ENOMEM;
884+ }
883885
884886 err = mlx5_pci_enable_device(dev);
885887 if (err) {
@@ -928,7 +930,7 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 42 unmodified lines
928930 pci_clear_master(dev->pdev);
929931 release_bar(dev->pdev);
930932 mlx5_pci_disable_device(dev);
931− debugfs_remove(priv->dbg_root);
933+ debugfs_remove_recursive(priv->dbg_root);
932934 }
933935
934936 static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
@@ -1286,7 +1288,7 @@ err_cleanup_once: · 351 unmodified lines
12861288 mlx5_cleanup_once(dev);
12871289
12881290 err_stop_poll:
1289− mlx5_stop_health_poll(dev);
1291+ mlx5_stop_health_poll(dev, boot);
12901292 if (mlx5_cmd_teardown_hca(dev)) {
12911293 dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
12921294 goto out_err;
@@ -1346,7 +1348,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, · 53 unmodified lines
13461348 mlx5_free_irq_vectors(dev);
13471349 if (cleanup)
13481350 mlx5_cleanup_once(dev);
1349− mlx5_stop_health_poll(dev);
1351+ mlx5_stop_health_poll(dev, cleanup);
13501352 err = mlx5_cmd_teardown_hca(dev);
13511353 if (err) {
13521354 dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
@@ -1608,7 +1610,7 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) · 255 unmodified lines
16081610 * with the HCA, so the health polll is no longer needed.
16091611 */
16101612 mlx5_drain_health_wq(dev);
1611− mlx5_stop_health_poll(dev);
1613+ mlx5_stop_health_poll(dev, false);
16121614
16131615 ret = mlx5_cmd_force_teardown_hca(dev);
16141616 if (ret) {
drivers/net/ethernet/mellanox/mlx5/core/transobj.c+1−1
@@ -509,7 +509,7 @@ static int mlx5_hairpin_modify_sq(struct mlx5_core_dev *peer_mdev, u32 sqn, · 508 unmodified lines
509509
510510 sqc = MLX5_ADDR_OF(modify_sq_in, in, ctx);
511511
512− if (next_state == MLX5_RQC_STATE_RDY) {
512+ if (next_state == MLX5_SQC_STATE_RDY) {
513513 MLX5_SET(sqc, sqc, hairpin_peer_rq, peer_rq);
514514 MLX5_SET(sqc, sqc, hairpin_peer_vhca, peer_vhca);
515515 }
drivers/net/ethernet/mellanox/mlx5/core/wq.c+3−3
@@ -39,9 +39,9 @@ u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq) · 38 unmodified lines
3939 return (u32)wq->fbc.sz_m1 + 1;
4040 }
4141
42−u32 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq)
42+u16 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq)
4343 {
44− return (u32)wq->fbc.frag_sz_m1 + 1;
44+ return wq->fbc.frag_sz_m1 + 1;
4545 }
4646
4747 u32 mlx5_cqwq_get_size(struct mlx5_cqwq *wq)
@@ -138,7 +138,7 @@ int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 90 unmodified lines
138138 void *qpc, struct mlx5_wq_qp *wq,
139139 struct mlx5_wq_ctrl *wq_ctrl)
140140 {
141− u32 sq_strides_offset;
141+ u16 sq_strides_offset;
142142 u32 rq_pg_remainder;
143143 int err;
144144
drivers/net/ethernet/mellanox/mlx5/core/wq.h+1−1
@@ -80,7 +80,7 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, · 79 unmodified lines
8080 void *wqc, struct mlx5_wq_cyc *wq,
8181 struct mlx5_wq_ctrl *wq_ctrl);
8282 u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq);
83−u32 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq);
83+u16 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq);
8484
8585 int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
8686 void *qpc, struct mlx5_wq_qp *wq,
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+2−2
@@ -44,8 +44,8 @@ · 43 unmodified lines
4444 #define MLXSW_SP_FWREV_MINOR_TO_BRANCH(minor) ((minor) / 100)
4545
4646 #define MLXSW_SP1_FWREV_MAJOR 13
47−#define MLXSW_SP1_FWREV_MINOR 1702
48−#define MLXSW_SP1_FWREV_SUBMINOR 6
47+#define MLXSW_SP1_FWREV_MINOR 1703
48+#define MLXSW_SP1_FWREV_SUBMINOR 4
4949 #define MLXSW_SP1_FWREV_CAN_RESET_MINOR 1702
5050
5151 static const struct mlxsw_fw_rev mlxsw_sp1_fw_rev = {
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c+8−8
@@ -337,14 +337,14 @@ static const struct mlxsw_sp_sb_cm mlxsw_sp_sb_cms_egress[] = { · 336 unmodified lines
337337 MLXSW_SP_SB_CM(1500, 9, 0),
338338 MLXSW_SP_SB_CM(1500, 9, 0),
339339 MLXSW_SP_SB_CM(1500, 9, 0),
340− MLXSW_SP_SB_CM(0, 0, 0),
341− MLXSW_SP_SB_CM(0, 0, 0),
342− MLXSW_SP_SB_CM(0, 0, 0),
343− MLXSW_SP_SB_CM(0, 0, 0),
344− MLXSW_SP_SB_CM(0, 0, 0),
345− MLXSW_SP_SB_CM(0, 0, 0),
346− MLXSW_SP_SB_CM(0, 0, 0),
347− MLXSW_SP_SB_CM(0, 0, 0),
340+ MLXSW_SP_SB_CM(0, 140000, 15),
341+ MLXSW_SP_SB_CM(0, 140000, 15),
342+ MLXSW_SP_SB_CM(0, 140000, 15),
343+ MLXSW_SP_SB_CM(0, 140000, 15),
344+ MLXSW_SP_SB_CM(0, 140000, 15),
345+ MLXSW_SP_SB_CM(0, 140000, 15),
346+ MLXSW_SP_SB_CM(0, 140000, 15),
347+ MLXSW_SP_SB_CM(0, 140000, 15),
348348 MLXSW_SP_SB_CM(1, 0xff, 0),
349349 };
350350
drivers/net/ethernet/microchip/lan743x_main.c+3−3
@@ -2850,7 +2850,7 @@ static void lan743x_pcidev_shutdown(struct pci_dev *pdev) · 2849 unmodified lines
28502850 lan743x_hardware_cleanup(adapter);
28512851 }
28522852
2853−#ifdef CONFIG_PM
2853+#ifdef CONFIG_PM_SLEEP
28542854 static u16 lan743x_pm_wakeframe_crc16(const u8 *buf, int len)
28552855 {
28562856 return bitrev16(crc16(0xFFFF, buf, len));
@@ -3016,7 +3016,7 @@ static int lan743x_pm_resume(struct device *dev) · 159 unmodified lines
30163016 static const struct dev_pm_ops lan743x_pm_ops = {
30173017 SET_SYSTEM_SLEEP_PM_OPS(lan743x_pm_suspend, lan743x_pm_resume)
30183018 };
3019−#endif /*CONFIG_PM */
3019+#endif /* CONFIG_PM_SLEEP */
30203020
30213021 static const struct pci_device_id lan743x_pcidev_tbl[] = {
30223022 { PCI_DEVICE(PCI_VENDOR_ID_SMSC, PCI_DEVICE_ID_SMSC_LAN7430) },
@@ -3028,7 +3028,7 @@ static struct pci_driver lan743x_pcidev_driver = { · 5 unmodified lines
30283028 .id_table = lan743x_pcidev_tbl,
30293029 .probe = lan743x_pcidev_probe,
30303030 .remove = lan743x_pcidev_remove,
3031−#ifdef CONFIG_PM
3031+#ifdef CONFIG_PM_SLEEP
30323032 .driver.pm = &lan743x_pm_ops,
30333033 #endif
30343034 .shutdown = lan743x_pcidev_shutdown,
drivers/net/ethernet/mscc/ocelot_board.c+9−3
@@ -91,7 +91,7 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg) · 90 unmodified lines
9191 struct sk_buff *skb;
9292 struct net_device *dev;
9393 u32 *buf;
94− int sz, len;
94+ int sz, len, buf_len;
9595 u32 ifh[4];
9696 u32 val;
9797 struct frame_info info;
@@ -116,14 +116,20 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg) · 18 unmodified lines
116116 err = -ENOMEM;
117117 break;
118118 }
119− buf = (u32 *)skb_put(skb, info.len);
119+ buf_len = info.len - ETH_FCS_LEN;
120+ buf = (u32 *)skb_put(skb, buf_len);
120121
121122 len = 0;
122123 do {
123124 sz = ocelot_rx_frame_word(ocelot, grp, false, &val);
124125 *buf++ = val;
125126 len += sz;
126− } while ((sz == 4) && (len < info.len));
127+ } while (len < buf_len);
128+
129+ /* Read the FCS and discard it */
130+ sz = ocelot_rx_frame_word(ocelot, grp, false, &val);
131+ /* Update the statistics if part of the FCS was read before */
132+ len -= ETH_FCS_LEN - sz;
127133
128134 if (sz < 0) {
129135 err = sz;
drivers/net/ethernet/netronome/nfp/flower/action.c+6−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #define NFP_FL_TUNNEL_CSUM cpu_to_be16(0x01)
5353 #define NFP_FL_TUNNEL_KEY cpu_to_be16(0x04)
5454 #define NFP_FL_TUNNEL_GENEVE_OPT cpu_to_be16(0x0800)
55+#define NFP_FL_SUPPORTED_TUNNEL_INFO_FLAGS IP_TUNNEL_INFO_TX
5556 #define NFP_FL_SUPPORTED_IPV4_UDP_TUN_FLAGS (NFP_FL_TUNNEL_CSUM | \
5657 NFP_FL_TUNNEL_KEY | \
5758 NFP_FL_TUNNEL_GENEVE_OPT)
@@ -741,11 +742,16 @@ nfp_flower_loop_action(struct nfp_app *app, const struct tc_action *a, · 683 unmodified lines
741742 nfp_fl_push_vlan(psh_v, a);
742743 *a_len += sizeof(struct nfp_fl_push_vlan);
743744 } else if (is_tcf_tunnel_set(a)) {
745+ struct ip_tunnel_info *ip_tun = tcf_tunnel_info(a);
744746 struct nfp_repr *repr = netdev_priv(netdev);
747+
745748 *tun_type = nfp_fl_get_tun_from_act_l4_port(repr->app, a);
746749 if (*tun_type == NFP_FL_TUNNEL_NONE)
747750 return -EOPNOTSUPP;
748751
752+ if (ip_tun->mode & ~NFP_FL_SUPPORTED_TUNNEL_INFO_FLAGS)
753+ return -EOPNOTSUPP;
754+
749755 /* Pre-tunnel action is required for tunnel encap.
750756 * This checks for next hop entries on NFP.
751757 * If none, the packet falls back before applying other actions.
drivers/net/ethernet/netronome/nfp/flower/main.h+1−0
@@ -70,6 +70,7 @@ struct nfp_app; · 69 unmodified lines
7070 #define NFP_FL_FEATS_GENEVE BIT(0)
7171 #define NFP_FL_NBI_MTU_SETTING BIT(1)
7272 #define NFP_FL_FEATS_GENEVE_OPT BIT(2)
73+#define NFP_FL_FEATS_VLAN_PCP BIT(3)
7374 #define NFP_FL_FEATS_LAG BIT(31)
7475
7576 struct nfp_fl_mask_id {
drivers/net/ethernet/netronome/nfp/flower/match.c+1−1
@@ -56,7 +56,7 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_tci *frame, · 55 unmodified lines
5656 FLOW_DISSECTOR_KEY_VLAN,
5757 target);
5858 /* Populate the tci field. */
59− if (flow_vlan->vlan_id) {
59+ if (flow_vlan->vlan_id || flow_vlan->vlan_priority) {
6060 tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
6161 flow_vlan->vlan_priority) |
6262 FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
drivers/net/ethernet/netronome/nfp/flower/offload.c+11−0
@@ -192,6 +192,17 @@ nfp_flower_calculate_key_layers(struct nfp_app *app, · 191 unmodified lines
192192 key_size += sizeof(struct nfp_flower_mac_mpls);
193193 }
194194
195+ if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_VLAN)) {
196+ struct flow_dissector_key_vlan *flow_vlan;
197+
198+ flow_vlan = skb_flow_dissector_target(flow->dissector,
199+ FLOW_DISSECTOR_KEY_VLAN,
200+ flow->mask);
201+ if (!(priv->flower_ext_feats & NFP_FL_FEATS_VLAN_PCP) &&
202+ flow_vlan->vlan_priority)
203+ return -EOPNOTSUPP;
204+ }
205+
195206 if (dissector_uses_key(flow->dissector,
196207 FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
197208 struct flow_dissector_key_ipv4_addrs *mask_ipv4 = NULL;
drivers/net/ethernet/netronome/nfp/nfp_net_common.c+0−18
@@ -3146,21 +3146,6 @@ nfp_net_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) · 3145 unmodified lines
31463146 return nfp_net_reconfig_mbox(nn, NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL);
31473147 }
31483148
3149−#ifdef CONFIG_NET_POLL_CONTROLLER
3150−static void nfp_net_netpoll(struct net_device *netdev)
3151−{
3152− struct nfp_net *nn = netdev_priv(netdev);
3153− int i;
3154−
3155− /* nfp_net's NAPIs are statically allocated so even if there is a race
3156− * with reconfig path this will simply try to schedule some disabled
3157− * NAPI instances.
3158− */
3159− for (i = 0; i < nn->dp.num_stack_tx_rings; i++)
3160− napi_schedule_irqoff(&nn->r_vecs[i].napi);
3161−}
3162−#endif
3163−
31643149 static void nfp_net_stat64(struct net_device *netdev,
31653150 struct rtnl_link_stats64 *stats)
31663151 {
@@ -3519,9 +3504,6 @@ const struct net_device_ops nfp_net_netdev_ops = { · 352 unmodified lines
35193504 .ndo_get_stats64 = nfp_net_stat64,
35203505 .ndo_vlan_rx_add_vid = nfp_net_vlan_rx_add_vid,
35213506 .ndo_vlan_rx_kill_vid = nfp_net_vlan_rx_kill_vid,
3522−#ifdef CONFIG_NET_POLL_CONTROLLER
3523− .ndo_poll_controller = nfp_net_netpoll,
3524−#endif
35253507 .ndo_set_vf_mac = nfp_app_set_vf_mac,
35263508 .ndo_set_vf_vlan = nfp_app_set_vf_vlan,
35273509 .ndo_set_vf_spoofchk = nfp_app_set_vf_spoofchk,
drivers/net/ethernet/qlogic/qed/qed_dcbx.c+28−17
@@ -190,10 +190,8 @@ qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data) · 189 unmodified lines
190190
191191 static void
192192 qed_dcbx_set_params(struct qed_dcbx_results *p_data,
193− struct qed_hw_info *p_info,
194− bool enable,
195− u8 prio,
196− u8 tc,
193+ struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
194+ bool enable, u8 prio, u8 tc,
197195 enum dcbx_protocol_type type,
198196 enum qed_pci_personality personality)
199197 {
@@ -206,19 +204,30 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data, · 6 unmodified lines
206204 else
207205 p_data->arr[type].update = DONT_UPDATE_DCB_DSCP;
208206
207+ /* Do not add vlan tag 0 when DCB is enabled and port in UFP/OV mode */
208+ if ((test_bit(QED_MF_8021Q_TAGGING, &p_hwfn->cdev->mf_bits) ||
209+ test_bit(QED_MF_8021AD_TAGGING, &p_hwfn->cdev->mf_bits)))
210+ p_data->arr[type].dont_add_vlan0 = true;
211+
209212 /* QM reconf data */
210− if (p_info->personality == personality)
211− qed_hw_info_set_offload_tc(p_info, tc);
213+ if (p_hwfn->hw_info.personality == personality)
214+ qed_hw_info_set_offload_tc(&p_hwfn->hw_info, tc);
215+
216+ /* Configure dcbx vlan priority in doorbell block for roce EDPM */
217+ if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) &&
218+ type == DCBX_PROTOCOL_ROCE) {
219+ qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 1);
220+ qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_PCP_BB_K2, prio << 1);
221+ }
212222 }
213223
214224 /* Update app protocol data and hw_info fields with the TLV info */
215225 static void
216226 qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
217− struct qed_hwfn *p_hwfn,
218− bool enable,
219− u8 prio, u8 tc, enum dcbx_protocol_type type)
227+ struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
228+ bool enable, u8 prio, u8 tc,
229+ enum dcbx_protocol_type type)
220230 {
221− struct qed_hw_info *p_info = &p_hwfn->hw_info;
222231 enum qed_pci_personality personality;
223232 enum dcbx_protocol_type id;
224233 int i;
@@ -231,7 +240,7 @@ qed_dcbx_update_app_info(struct qed_dcbx_results *p_data, · 6 unmodified lines
231240
232241 personality = qed_dcbx_app_update[i].personality;
233242
234− qed_dcbx_set_params(p_data, p_info, enable,
243+ qed_dcbx_set_params(p_data, p_hwfn, p_ptt, enable,
235244 prio, tc, type, personality);
236245 }
237246 }
@@ -265,7 +274,7 @@ qed_dcbx_get_app_protocol_type(struct qed_hwfn *p_hwfn, · 27 unmodified lines
265274 * reconfiguring QM. Get protocol specific data for PF update ramrod command.
266275 */
267276 static int
268−qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
277+qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
269278 struct qed_dcbx_results *p_data,
270279 struct dcbx_app_priority_entry *p_tbl,
271280 u32 pri_tc_tbl, int count, u8 dcbx_version)
@@ -309,7 +318,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, · 37 unmodified lines
309318 enable = true;
310319 }
311320
312− qed_dcbx_update_app_info(p_data, p_hwfn, enable,
321+ qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable,
313322 priority, tc, type);
314323 }
315324 }
@@ -331,7 +340,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, · 15 unmodified lines
331340 continue;
332341
333342 enable = (type == DCBX_PROTOCOL_ETH) ? false : !!dcbx_version;
334− qed_dcbx_update_app_info(p_data, p_hwfn, enable,
343+ qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable,
335344 priority, tc, type);
336345 }
337346
@@ -341,7 +350,8 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, · 3 unmodified lines
341350 /* Parse app TLV's to update TC information in hw_info structure for
342351 * reconfiguring QM. Get protocol specific data for PF update ramrod command.
343352 */
344−static int qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn)
353+static int
354+qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
345355 {
346356 struct dcbx_app_priority_feature *p_app;
347357 struct dcbx_app_priority_entry *p_tbl;
@@ -365,7 +375,7 @@ static int qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn) · 17 unmodified lines
365375 p_info = &p_hwfn->hw_info;
366376 num_entries = QED_MFW_GET_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES);
367377
368− rc = qed_dcbx_process_tlv(p_hwfn, &data, p_tbl, pri_tc_tbl,
378+ rc = qed_dcbx_process_tlv(p_hwfn, p_ptt, &data, p_tbl, pri_tc_tbl,
369379 num_entries, dcbx_version);
370380 if (rc)
371381 return rc;
@@ -891,7 +901,7 @@ qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn, · 519 unmodified lines
891901 return rc;
892902
893903 if (type == QED_DCBX_OPERATIONAL_MIB) {
894− rc = qed_dcbx_process_mib_info(p_hwfn);
904+ rc = qed_dcbx_process_mib_info(p_hwfn, p_ptt);
895905 if (!rc) {
896906 /* reconfigure tcs of QM queues according
897907 * to negotiation results
@@ -954,6 +964,7 @@ static void qed_dcbx_update_protocol_data(struct protocol_dcb_data *p_data, · 56 unmodified lines
954964 p_data->dcb_enable_flag = p_src->arr[type].enable;
955965 p_data->dcb_priority = p_src->arr[type].priority;
956966 p_data->dcb_tc = p_src->arr[type].tc;
967+ p_data->dcb_dont_add_vlan0 = p_src->arr[type].dont_add_vlan0;
957968 }
958969
959970 /* Set pf update ramrod command params */
drivers/net/ethernet/qlogic/qed/qed_dcbx.h+1−0
@@ -55,6 +55,7 @@ struct qed_dcbx_app_data { · 54 unmodified lines
5555 u8 update; /* Update indication */
5656 u8 priority; /* Priority */
5757 u8 tc; /* Traffic Class */
58+ bool dont_add_vlan0; /* Do not insert a vlan tag with id 0 */
5859 };
5960
6061 #define QED_DCBX_VERSION_DISABLED 0
drivers/net/ethernet/qlogic/qed/qed_dev.c+14−1
@@ -1706,7 +1706,7 @@ static int qed_vf_start(struct qed_hwfn *p_hwfn, · 1705 unmodified lines
17061706 int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params)
17071707 {
17081708 struct qed_load_req_params load_req_params;
1709− u32 load_code, param, drv_mb_param;
1709+ u32 load_code, resp, param, drv_mb_param;
17101710 bool b_default_mtu = true;
17111711 struct qed_hwfn *p_hwfn;
17121712 int rc = 0, mfw_rc, i;
@@ -1852,6 +1852,19 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params) · 139 unmodified lines
18521852
18531853 if (IS_PF(cdev)) {
18541854 p_hwfn = QED_LEADING_HWFN(cdev);
1855+
1856+ /* Get pre-negotiated values for stag, bandwidth etc. */
1857+ DP_VERBOSE(p_hwfn,
1858+ QED_MSG_SPQ,
1859+ "Sending GET_OEM_UPDATES command to trigger stag/bandwidth attention handling\n");
1860+ drv_mb_param = 1 << DRV_MB_PARAM_DUMMY_OEM_UPDATES_OFFSET;
1861+ rc = qed_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
1862+ DRV_MSG_CODE_GET_OEM_UPDATES,
1863+ drv_mb_param, &resp, &param);
1864+ if (rc)
1865+ DP_NOTICE(p_hwfn,
1866+ "Failed to send GET_OEM_UPDATES attention request\n");
1867+
18551868 drv_mb_param = STORM_FW_VERSION;
18561869 rc = qed_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
18571870 DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER,
drivers/net/ethernet/qlogic/qed/qed_hsi.h+4−0
@@ -12414,6 +12414,7 @@ struct public_drv_mb { · 12413 unmodified lines
1241412414 #define DRV_MSG_SET_RESOURCE_VALUE_MSG 0x35000000
1241512415 #define DRV_MSG_CODE_OV_UPDATE_WOL 0x38000000
1241612416 #define DRV_MSG_CODE_OV_UPDATE_ESWITCH_MODE 0x39000000
12417+#define DRV_MSG_CODE_GET_OEM_UPDATES 0x41000000
1241712418
1241812419 #define DRV_MSG_CODE_BW_UPDATE_ACK 0x32000000
1241912420 #define DRV_MSG_CODE_NIG_DRAIN 0x30000000
@@ -12541,6 +12542,9 @@ struct public_drv_mb { · 121 unmodified lines
1254112542 #define DRV_MB_PARAM_ESWITCH_MODE_VEB 0x1
1254212543 #define DRV_MB_PARAM_ESWITCH_MODE_VEPA 0x2
1254312544
12545+#define DRV_MB_PARAM_DUMMY_OEM_UPDATES_MASK 0x1
12546+#define DRV_MB_PARAM_DUMMY_OEM_UPDATES_OFFSET 0
12547+
1254412548 #define DRV_MB_PARAM_SET_LED_MODE_OPER 0x0
1254512549 #define DRV_MB_PARAM_SET_LED_MODE_ON 0x1
1254612550 #define DRV_MB_PARAM_SET_LED_MODE_OFF 0x2
drivers/net/ethernet/qlogic/qed/qed_mcp.c+20−4
@@ -1581,13 +1581,29 @@ static void qed_mcp_update_stag(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) · 1580 unmodified lines
15811581 p_hwfn->mcp_info->func_info.ovlan = (u16)shmem_info.ovlan_stag &
15821582 FUNC_MF_CFG_OV_STAG_MASK;
15831583 p_hwfn->hw_info.ovlan = p_hwfn->mcp_info->func_info.ovlan;
1584− if ((p_hwfn->hw_info.hw_mode & BIT(MODE_MF_SD)) &&
1585− (p_hwfn->hw_info.ovlan != QED_MCP_VLAN_UNSET)) {
1586− qed_wr(p_hwfn, p_ptt,
1587− NIG_REG_LLH_FUNC_TAG_VALUE, p_hwfn->hw_info.ovlan);
1584+ if (test_bit(QED_MF_OVLAN_CLSS, &p_hwfn->cdev->mf_bits)) {
1585+ if (p_hwfn->hw_info.ovlan != QED_MCP_VLAN_UNSET) {
1586+ qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_VALUE,
1587+ p_hwfn->hw_info.ovlan);
1588+ qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_EN, 1);
1589+
1590+ /* Configure DB to add external vlan to EDPM packets */
1591+ qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 1);
1592+ qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_EXT_VID_BB_K2,
1593+ p_hwfn->hw_info.ovlan);
1594+ } else {
1595+ qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_EN, 0);
1596+ qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_VALUE, 0);
1597+ qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 0);
1598+ qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_EXT_VID_BB_K2, 0);
1599+ }
1600+
15881601 qed_sp_pf_update_stag(p_hwfn);
15891602 }
15901603
1604+ DP_VERBOSE(p_hwfn, QED_MSG_SP, "ovlan = %d hw_mode = 0x%x\n",
1605+ p_hwfn->mcp_info->func_info.ovlan, p_hwfn->hw_info.hw_mode);
1606+
15911607 /* Acknowledge the MFW */
15921608 qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_S_TAG_UPDATE_ACK, 0,
15931609 &resp, &param);
drivers/net/ethernet/qlogic/qed/qed_reg_addr.h+6−0
@@ -216,6 +216,12 @@ · 215 unmodified lines
216216 0x00c000UL
217217 #define DORQ_REG_IFEN \
218218 0x100040UL
219+#define DORQ_REG_TAG1_OVRD_MODE \
220+ 0x1008b4UL
221+#define DORQ_REG_PF_PCP_BB_K2 \
222+ 0x1008c4UL
223+#define DORQ_REG_PF_EXT_VID_BB_K2 \
224+ 0x1008c8UL
219225 #define DORQ_REG_DB_DROP_REASON \
220226 0x100a2cUL
221227 #define DORQ_REG_DB_DROP_DETAILS \
drivers/net/ethernet/qualcomm/qca_7k.c+36−40
@@ -45,34 +45,33 @@ qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result) · 44 unmodified lines
4545 {
4646 __be16 rx_data;
4747 __be16 tx_data;
48− struct spi_transfer *transfer;
49− struct spi_message *msg;
48+ struct spi_transfer transfer[2];
49+ struct spi_message msg;
5050 int ret;
5151
52+ memset(transfer, 0, sizeof(transfer));
53+
54+ spi_message_init(&msg);
55+
5256 tx_data = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_INTERNAL | reg);
57+ *result = 0;
58+
59+ transfer[0].tx_buf = &tx_data;
60+ transfer[0].len = QCASPI_CMD_LEN;
61+ transfer[1].rx_buf = &rx_data;
62+ transfer[1].len = QCASPI_CMD_LEN;
63+
64+ spi_message_add_tail(&transfer[0], &msg);
5365
5466 if (qca->legacy_mode) {
55− msg = &qca->spi_msg1;
56− transfer = &qca->spi_xfer1;
57− transfer->tx_buf = &tx_data;
58− transfer->rx_buf = NULL;
59− transfer->len = QCASPI_CMD_LEN;
60− spi_sync(qca->spi_dev, msg);
61− } else {
62− msg = &qca->spi_msg2;
63− transfer = &qca->spi_xfer2[0];
64− transfer->tx_buf = &tx_data;
65− transfer->rx_buf = NULL;
66− transfer->len = QCASPI_CMD_LEN;
67− transfer = &qca->spi_xfer2[1];
67+ spi_sync(qca->spi_dev, &msg);
68+ spi_message_init(&msg);
6869 }
69− transfer->tx_buf = NULL;
70− transfer->rx_buf = &rx_data;
71− transfer->len = QCASPI_CMD_LEN;
72− ret = spi_sync(qca->spi_dev, msg);
70+ spi_message_add_tail(&transfer[1], &msg);
71+ ret = spi_sync(qca->spi_dev, &msg);
7372
7473 if (!ret)
75− ret = msg->status;
74+ ret = msg.status;
7675
7776 if (ret)
7877 qcaspi_spi_error(qca);
@@ -86,35 +85,32 @@ int · 7 unmodified lines
8685 qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value)
8786 {
8887 __be16 tx_data[2];
89− struct spi_transfer *transfer;
90− struct spi_message *msg;
88+ struct spi_transfer transfer[2];
89+ struct spi_message msg;
9190 int ret;
9291
92+ memset(&transfer, 0, sizeof(transfer));
93+
94+ spi_message_init(&msg);
95+
9396 tx_data[0] = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_INTERNAL | reg);
9497 tx_data[1] = cpu_to_be16(value);
9598
99+ transfer[0].tx_buf = &tx_data[0];
100+ transfer[0].len = QCASPI_CMD_LEN;
101+ transfer[1].tx_buf = &tx_data[1];
102+ transfer[1].len = QCASPI_CMD_LEN;
103+
104+ spi_message_add_tail(&transfer[0], &msg);
96105 if (qca->legacy_mode) {
97− msg = &qca->spi_msg1;
98− transfer = &qca->spi_xfer1;
99− transfer->tx_buf = &tx_data[0];
100− transfer->rx_buf = NULL;
101− transfer->len = QCASPI_CMD_LEN;
102− spi_sync(qca->spi_dev, msg);
103− } else {
104− msg = &qca->spi_msg2;
105− transfer = &qca->spi_xfer2[0];
106− transfer->tx_buf = &tx_data[0];
107− transfer->rx_buf = NULL;
108− transfer->len = QCASPI_CMD_LEN;
109− transfer = &qca->spi_xfer2[1];
106+ spi_sync(qca->spi_dev, &msg);
107+ spi_message_init(&msg);
110108 }
111− transfer->tx_buf = &tx_data[1];
112− transfer->rx_buf = NULL;
113− transfer->len = QCASPI_CMD_LEN;
114− ret = spi_sync(qca->spi_dev, msg);
109+ spi_message_add_tail(&transfer[1], &msg);
110+ ret = spi_sync(qca->spi_dev, &msg);
115111
116112 if (!ret)
117− ret = msg->status;
113+ ret = msg.status;
118114
119115 if (ret)
120116 qcaspi_spi_error(qca);
drivers/net/ethernet/qualcomm/qca_spi.c+57−53
@@ -99,22 +99,24 @@ static u32 · 98 unmodified lines
9999 qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len)
100100 {
101101 __be16 cmd;
102− struct spi_message *msg = &qca->spi_msg2;
103− struct spi_transfer *transfer = &qca->spi_xfer2[0];
102+ struct spi_message msg;
103+ struct spi_transfer transfer[2];
104104 int ret;
105105
106+ memset(&transfer, 0, sizeof(transfer));
107+ spi_message_init(&msg);
108+
106109 cmd = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_EXTERNAL);
107− transfer->tx_buf = &cmd;
108− transfer->rx_buf = NULL;
109− transfer->len = QCASPI_CMD_LEN;
110− transfer = &qca->spi_xfer2[1];
111− transfer->tx_buf = src;
112− transfer->rx_buf = NULL;
113− transfer->len = len;
110+ transfer[0].tx_buf = &cmd;
111+ transfer[0].len = QCASPI_CMD_LEN;
112+ transfer[1].tx_buf = src;
113+ transfer[1].len = len;
114114
115− ret = spi_sync(qca->spi_dev, msg);
115+ spi_message_add_tail(&transfer[0], &msg);
116+ spi_message_add_tail(&transfer[1], &msg);
117+ ret = spi_sync(qca->spi_dev, &msg);
116118
117− if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) {
119+ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) {
118120 qcaspi_spi_error(qca);
119121 return 0;
120122 }
@@ -125,17 +127,20 @@ qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len) · 4 unmodified lines
125127 static u32
126128 qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len)
127129 {
128− struct spi_message *msg = &qca->spi_msg1;
129− struct spi_transfer *transfer = &qca->spi_xfer1;
130+ struct spi_message msg;
131+ struct spi_transfer transfer;
130132 int ret;
131133
132− transfer->tx_buf = src;
133− transfer->rx_buf = NULL;
134− transfer->len = len;
134+ memset(&transfer, 0, sizeof(transfer));
135+ spi_message_init(&msg);
136+
137+ transfer.tx_buf = src;
138+ transfer.len = len;
135139
136− ret = spi_sync(qca->spi_dev, msg);
140+ spi_message_add_tail(&transfer, &msg);
141+ ret = spi_sync(qca->spi_dev, &msg);
137142
138− if (ret || (msg->actual_length != len)) {
143+ if (ret || (msg.actual_length != len)) {
139144 qcaspi_spi_error(qca);
140145 return 0;
141146 }
@@ -146,23 +151,25 @@ qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len) · 4 unmodified lines
146151 static u32
147152 qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len)
148153 {
149− struct spi_message *msg = &qca->spi_msg2;
154+ struct spi_message msg;
150155 __be16 cmd;
151− struct spi_transfer *transfer = &qca->spi_xfer2[0];
156+ struct spi_transfer transfer[2];
152157 int ret;
153158
159+ memset(&transfer, 0, sizeof(transfer));
160+ spi_message_init(&msg);
161+
154162 cmd = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_EXTERNAL);
155− transfer->tx_buf = &cmd;
156− transfer->rx_buf = NULL;
157− transfer->len = QCASPI_CMD_LEN;
158− transfer = &qca->spi_xfer2[1];
159− transfer->tx_buf = NULL;
160− transfer->rx_buf = dst;
161− transfer->len = len;
163+ transfer[0].tx_buf = &cmd;
164+ transfer[0].len = QCASPI_CMD_LEN;
165+ transfer[1].rx_buf = dst;
166+ transfer[1].len = len;
162167
163− ret = spi_sync(qca->spi_dev, msg);
168+ spi_message_add_tail(&transfer[0], &msg);
169+ spi_message_add_tail(&transfer[1], &msg);
170+ ret = spi_sync(qca->spi_dev, &msg);
164171
165− if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) {
172+ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) {
166173 qcaspi_spi_error(qca);
167174 return 0;
168175 }
@@ -173,17 +180,20 @@ qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len) · 4 unmodified lines
173180 static u32
174181 qcaspi_read_legacy(struct qcaspi *qca, u8 *dst, u32 len)
175182 {
176− struct spi_message *msg = &qca->spi_msg1;
177− struct spi_transfer *transfer = &qca->spi_xfer1;
183+ struct spi_message msg;
184+ struct spi_transfer transfer;
178185 int ret;
179186
180− transfer->tx_buf = NULL;
181− transfer->rx_buf = dst;
182− transfer->len = len;
187+ memset(&transfer, 0, sizeof(transfer));
188+ spi_message_init(&msg);
183189
184− ret = spi_sync(qca->spi_dev, msg);
190+ transfer.rx_buf = dst;
191+ transfer.len = len;
185192
186− if (ret || (msg->actual_length != len)) {
193+ spi_message_add_tail(&transfer, &msg);
194+ ret = spi_sync(qca->spi_dev, &msg);
195+
196+ if (ret || (msg.actual_length != len)) {
187197 qcaspi_spi_error(qca);
188198 return 0;
189199 }
@@ -195,19 +205,23 @@ static int · 5 unmodified lines
195205 qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd)
196206 {
197207 __be16 tx_data;
198− struct spi_message *msg = &qca->spi_msg1;
199− struct spi_transfer *transfer = &qca->spi_xfer1;
208+ struct spi_message msg;
209+ struct spi_transfer transfer;
200210 int ret;
201211
212+ memset(&transfer, 0, sizeof(transfer));
213+
214+ spi_message_init(&msg);
215+
202216 tx_data = cpu_to_be16(cmd);
203− transfer->len = sizeof(tx_data);
204− transfer->tx_buf = &tx_data;
205− transfer->rx_buf = NULL;
217+ transfer.len = sizeof(cmd);
218+ transfer.tx_buf = &tx_data;
219+ spi_message_add_tail(&transfer, &msg);
206220
207− ret = spi_sync(qca->spi_dev, msg);
221+ ret = spi_sync(qca->spi_dev, &msg);
208222
209223 if (!ret)
210− ret = msg->status;
224+ ret = msg.status;
211225
212226 if (ret)
213227 qcaspi_spi_error(qca);
@@ -835,16 +849,6 @@ qcaspi_netdev_setup(struct net_device *dev) · 621 unmodified lines
835849 qca = netdev_priv(dev);
836850 memset(qca, 0, sizeof(struct qcaspi));
837851
838− memset(&qca->spi_xfer1, 0, sizeof(struct spi_transfer));
839− memset(&qca->spi_xfer2, 0, sizeof(struct spi_transfer) * 2);
840−
841− spi_message_init(&qca->spi_msg1);
842− spi_message_add_tail(&qca->spi_xfer1, &qca->spi_msg1);
843−
844− spi_message_init(&qca->spi_msg2);
845− spi_message_add_tail(&qca->spi_xfer2[0], &qca->spi_msg2);
846− spi_message_add_tail(&qca->spi_xfer2[1], &qca->spi_msg2);
847−
848852 memset(&qca->txr, 0, sizeof(qca->txr));
849853 qca->txr.count = TX_RING_MAX_LEN;
850854 }
drivers/net/ethernet/qualcomm/qca_spi.h+0−5
@@ -83,11 +83,6 @@ struct qcaspi { · 82 unmodified lines
8383 struct tx_ring txr;
8484 struct qcaspi_stats stats;
8585
86− struct spi_message spi_msg1;
87− struct spi_message spi_msg2;
88− struct spi_transfer spi_xfer1;
89− struct spi_transfer spi_xfer2[2];
90−
9186 u8 *rx_buffer;
9287 u32 buffer_size;
9388 u8 sync;
drivers/net/ethernet/realtek/r8169.c+55−5
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/pci.h>
1414 #include <linux/netdevice.h>
1515 #include <linux/etherdevice.h>
16+#include <linux/clk.h>
1617 #include <linux/delay.h>
1718 #include <linux/ethtool.h>
1819 #include <linux/phy.h>
@@ -631,7 +632,7 @@ struct rtl8169_tc_offsets { · 612 unmodified lines
631632 };
632633
633634 enum rtl_flag {
634− RTL_FLAG_TASK_ENABLED,
635+ RTL_FLAG_TASK_ENABLED = 0,
635636 RTL_FLAG_TASK_SLOW_PENDING,
636637 RTL_FLAG_TASK_RESET_PENDING,
637638 RTL_FLAG_MAX
@@ -665,6 +666,7 @@ struct rtl8169_private { · 27 unmodified lines
665666
666667 u16 event_slow;
667668 const struct rtl_coalesce_info *coalesce_info;
669+ struct clk *clk;
668670
669671 struct mdio_ops {
670672 void (*write)(struct rtl8169_private *, int, int);
@@ -4069,6 +4071,15 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) · 3398 unmodified lines
40694071 phy_speed_up(dev->phydev);
40704072
40714073 genphy_soft_reset(dev->phydev);
4074+
4075+ /* It was reported that chip version 33 ends up with 10MBit/Half on a
4076+ * 1GBit link after resuming from S3. For whatever reason the PHY on
4077+ * this chip doesn't properly start a renegotiation when soft-reset.
4078+ * Explicitly requesting a renegotiation fixes this.
4079+ */
4080+ if (tp->mac_version == RTL_GIGA_MAC_VER_33 &&
4081+ dev->phydev->autoneg == AUTONEG_ENABLE)
4082+ phy_restart_aneg(dev->phydev);
40724083 }
40734084
40744085 static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
@@ -4634,13 +4645,13 @@ static void rtl_hw_start(struct rtl8169_private *tp) · 559 unmodified lines
46344645
46354646 rtl_set_rx_max_size(tp);
46364647 rtl_set_rx_tx_desc_registers(tp);
4637− rtl_set_tx_config_registers(tp);
46384648 RTL_W8(tp, Cfg9346, Cfg9346_Lock);
46394649
46404650 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */
46414651 RTL_R8(tp, IntrMask);
46424652 RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
46434653 rtl_init_rxcfg(tp);
4654+ rtl_set_tx_config_registers(tp);
46444655
46454656 rtl_set_rx_mode(tp->dev);
46464657 /* no early-rx interrupts */
@@ -4775,12 +4786,14 @@ static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable) · 128 unmodified lines
47754786 static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable)
47764787 {
47774788 if (enable) {
4778− RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn);
47794789 RTL_W8(tp, Config5, RTL_R8(tp, Config5) | ASPM_en);
4790+ RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn);
47804791 } else {
47814792 RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~ClkReqEn);
47824793 RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~ASPM_en);
47834794 }
4795+
4796+ udelay(10);
47844797 }
47854798
47864799 static void rtl_hw_start_8168bb(struct rtl8169_private *tp)
@@ -5625,6 +5638,8 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) · 838 unmodified lines
56255638
56265639 static void rtl_hw_start_8106(struct rtl8169_private *tp)
56275640 {
5641+ rtl_hw_aspm_clkreq_enable(tp, false);
5642+
56285643 /* Force LAN exit from ASPM if Rx/Tx are not idle */
56295644 RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800);
56305645
@@ -5633,6 +5648,7 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp) · 2 unmodified lines
56335648 RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~PFM_EN);
56345649
56355650 rtl_pcie_state_l2l3_enable(tp, false);
5651+ rtl_hw_aspm_clkreq_enable(tp, true);
56365652 }
56375653
56385654 static void rtl_hw_start_8101(struct rtl8169_private *tp)
@@ -6655,7 +6671,8 @@ static int rtl8169_close(struct net_device *dev) · 1016 unmodified lines
66556671 rtl8169_update_counters(tp);
66566672
66576673 rtl_lock_work(tp);
6658− clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
6674+ /* Clear all task flags */
6675+ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
66596676
66606677 rtl8169_down(dev);
66616678 rtl_unlock_work(tp);
@@ -6838,7 +6855,9 @@ static void rtl8169_net_suspend(struct net_device *dev) · 176 unmodified lines
68386855
68396856 rtl_lock_work(tp);
68406857 napi_disable(&tp->napi);
6841− clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
6858+ /* Clear all task flags */
6859+ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
6860+
68426861 rtl_unlock_work(tp);
68436862
68446863 rtl_pll_power_down(tp);
@@ -7254,6 +7273,11 @@ static int rtl_jumbo_max(struct rtl8169_private *tp) · 409 unmodified lines
72547273 }
72557274 }
72567275
7276+static void rtl_disable_clk(void *data)
7277+{
7278+ clk_disable_unprepare(data);
7279+}
7280+
72577281 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
72587282 {
72597283 const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
@@ -7274,6 +7298,32 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 14 unmodified lines
72747298 tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT);
72757299 tp->supports_gmii = cfg->has_gmii;
72767300
7301+ /* Get the *optional* external "ether_clk" used on some boards */
7302+ tp->clk = devm_clk_get(&pdev->dev, "ether_clk");
7303+ if (IS_ERR(tp->clk)) {
7304+ rc = PTR_ERR(tp->clk);
7305+ if (rc == -ENOENT) {
7306+ /* clk-core allows NULL (for suspend / resume) */
7307+ tp->clk = NULL;
7308+ } else if (rc == -EPROBE_DEFER) {
7309+ return rc;
7310+ } else {
7311+ dev_err(&pdev->dev, "failed to get clk: %d\n", rc);
7312+ return rc;
7313+ }
7314+ } else {
7315+ rc = clk_prepare_enable(tp->clk);
7316+ if (rc) {
7317+ dev_err(&pdev->dev, "failed to enable clk: %d\n", rc);
7318+ return rc;
7319+ }
7320+
7321+ rc = devm_add_action_or_reset(&pdev->dev, rtl_disable_clk,
7322+ tp->clk);
7323+ if (rc)
7324+ return rc;
7325+ }
7326+
72777327 /* enable device (incl. PCI PM wakeup and hotplug setup) */
72787328 rc = pcim_enable_device(pdev);
72797329 if (rc < 0) {
drivers/net/ethernet/renesas/Kconfig+1−0
@@ -1,3 +1,4 @@
1+# SPDX-License-Identifier: GPL-2.0
12 #
23 # Renesas device configuration
34 #
drivers/net/ethernet/renesas/Makefile+1−0
@@ -1,3 +1,4 @@
1+# SPDX-License-Identifier: GPL-2.0
12 #
23 # Makefile for the Renesas device drivers.
34 #
drivers/net/ethernet/renesas/ravb.h+5−0
@@ -428,6 +428,7 @@ enum EIS_BIT { · 427 unmodified lines
428428 EIS_CULF1 = 0x00000080,
429429 EIS_TFFF = 0x00000100,
430430 EIS_QFS = 0x00010000,
431+ EIS_RESERVED = (GENMASK(31, 17) | GENMASK(15, 11)),
431432 };
432433
433434 /* RIC0 */
@@ -472,6 +473,7 @@ enum RIS0_BIT { · 38 unmodified lines
472473 RIS0_FRF15 = 0x00008000,
473474 RIS0_FRF16 = 0x00010000,
474475 RIS0_FRF17 = 0x00020000,
476+ RIS0_RESERVED = GENMASK(31, 18),
475477 };
476478
477479 /* RIC1 */
@@ -528,6 +530,7 @@ enum RIS2_BIT { · 50 unmodified lines
528530 RIS2_QFF16 = 0x00010000,
529531 RIS2_QFF17 = 0x00020000,
530532 RIS2_RFFF = 0x80000000,
533+ RIS2_RESERVED = GENMASK(30, 18),
531534 };
532535
533536 /* TIC */
@@ -544,6 +547,7 @@ enum TIS_BIT { · 10 unmodified lines
544547 TIS_FTF1 = 0x00000002, /* Undocumented? */
545548 TIS_TFUF = 0x00000100,
546549 TIS_TFWF = 0x00000200,
550+ TIS_RESERVED = (GENMASK(31, 20) | GENMASK(15, 12) | GENMASK(7, 4))
547551 };
548552
549553 /* ISS */
@@ -617,6 +621,7 @@ enum GIC_BIT { · 67 unmodified lines
617621 enum GIS_BIT {
618622 GIS_PTCF = 0x00000001, /* Undocumented? */
619623 GIS_PTMF = 0x00000004,
624+ GIS_RESERVED = GENMASK(15, 10),
620625 };
621626
622627 /* GIE (R-Car Gen3 only) */
drivers/net/ethernet/renesas/ravb_main.c+6−5
@@ -739,10 +739,11 @@ static void ravb_error_interrupt(struct net_device *ndev) · 738 unmodified lines
739739 u32 eis, ris2;
740740
741741 eis = ravb_read(ndev, EIS);
742− ravb_write(ndev, ~EIS_QFS, EIS);
742+ ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
743743 if (eis & EIS_QFS) {
744744 ris2 = ravb_read(ndev, RIS2);
745− ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF), RIS2);
745+ ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
746+ RIS2);
746747
747748 /* Receive Descriptor Empty int */
748749 if (ris2 & RIS2_QFF0)
@@ -795,7 +796,7 @@ static bool ravb_timestamp_interrupt(struct net_device *ndev) · 46 unmodified lines
795796 u32 tis = ravb_read(ndev, TIS);
796797
797798 if (tis & TIS_TFUF) {
798− ravb_write(ndev, ~TIS_TFUF, TIS);
799+ ravb_write(ndev, ~(TIS_TFUF | TIS_RESERVED), TIS);
799800 ravb_get_tx_tstamp(ndev);
800801 return true;
801802 }
@@ -930,7 +931,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) · 128 unmodified lines
930931 /* Processing RX Descriptor Ring */
931932 if (ris0 & mask) {
932933 /* Clear RX interrupt */
933− ravb_write(ndev, ~mask, RIS0);
934+ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
934935 if (ravb_rx(ndev, &quota, q))
935936 goto out;
936937 }
@@ -938,7 +939,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) · 1 unmodified line
938939 if (tis & mask) {
939940 spin_lock_irqsave(&priv->lock, flags);
940941 /* Clear TX interrupt */
941− ravb_write(ndev, ~mask, TIS);
942+ ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
942943 ravb_tx_free(ndev, q, true);
943944 netif_wake_subqueue(ndev, q);
944945 mmiowb();
drivers/net/ethernet/renesas/ravb_ptp.c+2−6
@@ -1,13 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0+
12 /* PTP 1588 clock using the Renesas Ethernet AVB
23 *
34 * Copyright (C) 2013-2015 Renesas Electronics Corporation
45 * Copyright (C) 2015 Renesas Solutions Corp.
56 * Copyright (C) 2015-2016 Cogent Embedded, Inc. <source@cogentembedded.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; either version 2 of the License, or
10− * (at your option) any later version.
117 */
128
139 #include "ravb.h"
@@ -319,7 +315,7 @@ void ravb_ptp_interrupt(struct net_device *ndev) · 305 unmodified lines
319315 }
320316 }
321317
322− ravb_write(ndev, ~gis, GIS);
318+ ravb_write(ndev, ~(gis | GIS_RESERVED), GIS);
323319 }
324320
325321 void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)
drivers/net/ethernet/seeq/ether3.c+3−2
@@ -77,7 +77,8 @@ static void ether3_setmulticastlist(struct net_device *dev); · 76 unmodified lines
7777 static int ether3_rx(struct net_device *dev, unsigned int maxcnt);
7878 static void ether3_tx(struct net_device *dev);
7979 static int ether3_open (struct net_device *dev);
80−static int ether3_sendpacket (struct sk_buff *skb, struct net_device *dev);
80+static netdev_tx_t ether3_sendpacket(struct sk_buff *skb,
81+ struct net_device *dev);
8182 static irqreturn_t ether3_interrupt (int irq, void *dev_id);
8283 static int ether3_close (struct net_device *dev);
8384 static void ether3_setmulticastlist (struct net_device *dev);
@@ -481,7 +482,7 @@ static void ether3_timeout(struct net_device *dev) · 397 unmodified lines
481482 /*
482483 * Transmit a packet
483484 */
484−static int
485+static netdev_tx_t
485486 ether3_sendpacket(struct sk_buff *skb, struct net_device *dev)
486487 {
487488 unsigned long flags;
drivers/net/ethernet/seeq/sgiseeq.c+2−1
@@ -578,7 +578,8 @@ static inline int sgiseeq_reset(struct net_device *dev) · 577 unmodified lines
578578 return 0;
579579 }
580580
581−static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
581+static netdev_tx_t
582+sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
582583 {
583584 struct sgiseeq_private *sp = netdev_priv(dev);
584585 struct hpc3_ethregs *hregs = sp->hregs;
drivers/net/ethernet/sgi/ioc3-eth.c+2−2
@@ -99,7 +99,7 @@ struct ioc3_private { · 98 unmodified lines
9999
100100 static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
101101 static void ioc3_set_multicast_list(struct net_device *dev);
102−static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev);
102+static netdev_tx_t ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev);
103103 static void ioc3_timeout(struct net_device *dev);
104104 static inline unsigned int ioc3_hash(const unsigned char *addr);
105105 static inline void ioc3_stop(struct ioc3_private *ip);
@@ -1390,7 +1390,7 @@ static struct pci_driver ioc3_driver = { · 1284 unmodified lines
13901390 .remove = ioc3_remove_one,
13911391 };
13921392
1393−static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
1393+static netdev_tx_t ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
13941394 {
13951395 unsigned long data;
13961396 struct ioc3_private *ip = netdev_priv(dev);
drivers/net/ethernet/sgi/meth.c+1−1
@@ -697,7 +697,7 @@ static void meth_add_to_tx_ring(struct meth_private *priv, struct sk_buff *skb) · 696 unmodified lines
697697 /*
698698 * Transmit a packet (called by the kernel)
699699 */
700−static int meth_tx(struct sk_buff *skb, struct net_device *dev)
700+static netdev_tx_t meth_tx(struct sk_buff *skb, struct net_device *dev)
701701 {
702702 struct meth_private *priv = netdev_priv(dev);
703703 unsigned long flags;
drivers/net/ethernet/stmicro/stmmac/common.h+2−2
@@ -258,10 +258,10 @@ struct stmmac_safety_stats { · 257 unmodified lines
258258 #define MAX_DMA_RIWT 0xff
259259 #define MIN_DMA_RIWT 0x20
260260 /* Tx coalesce parameters */
261−#define STMMAC_COAL_TX_TIMER 40000
261+#define STMMAC_COAL_TX_TIMER 1000
262262 #define STMMAC_MAX_COAL_TX_TICK 100000
263263 #define STMMAC_TX_MAX_FRAMES 256
264−#define STMMAC_TX_FRAMES 64
264+#define STMMAC_TX_FRAMES 25
265265
266266 /* Packets types */
267267 enum packets_types {
drivers/net/ethernet/stmicro/stmmac/stmmac.h+12−2
@@ -48,6 +48,8 @@ struct stmmac_tx_info { · 47 unmodified lines
4848
4949 /* Frequently used values are kept adjacent for cache effect */
5050 struct stmmac_tx_queue {
51+ u32 tx_count_frames;
52+ struct timer_list txtimer;
5153 u32 queue_index;
5254 struct stmmac_priv *priv_data;
5355 struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp;
@@ -73,7 +75,14 @@ struct stmmac_rx_queue { · 19 unmodified lines
7375 u32 rx_zeroc_thresh;
7476 dma_addr_t dma_rx_phy;
7577 u32 rx_tail_addr;
78+};
79+
80+struct stmmac_channel {
7681 struct napi_struct napi ____cacheline_aligned_in_smp;
82+ struct stmmac_priv *priv_data;
83+ u32 index;
84+ int has_rx;
85+ int has_tx;
7786 };
7887
7988 struct stmmac_tc_entry {
@@ -109,14 +118,12 @@ struct stmmac_pps_cfg { · 29 unmodified lines
109118
110119 struct stmmac_priv {
111120 /* Frequently used values are kept adjacent for cache effect */
112− u32 tx_count_frames;
113121 u32 tx_coal_frames;
114122 u32 tx_coal_timer;
115123
116124 int tx_coalesce;
117125 int hwts_tx_en;
118126 bool tx_path_in_lpi_mode;
119− struct timer_list txtimer;
120127 bool tso;
121128
122129 unsigned int dma_buf_sz;
@@ -137,6 +144,9 @@ struct stmmac_priv { · 14 unmodified lines
137144 /* TX Queue */
138145 struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES];
139146
147+ /* Generic channel for NAPI */
148+ struct stmmac_channel channel[STMMAC_CH_MAX];
149+
140150 bool oldlink;
141151 int speed;
142152 int oldduplex;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+134−104
@@ -148,12 +148,14 @@ static void stmmac_verify_args(void) · 147 unmodified lines
148148 static void stmmac_disable_all_queues(struct stmmac_priv *priv)
149149 {
150150 u32 rx_queues_cnt = priv->plat->rx_queues_to_use;
151+ u32 tx_queues_cnt = priv->plat->tx_queues_to_use;
152+ u32 maxq = max(rx_queues_cnt, tx_queues_cnt);
151153 u32 queue;
152154
153− for (queue = 0; queue < rx_queues_cnt; queue++) {
154− struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
155+ for (queue = 0; queue < maxq; queue++) {
156+ struct stmmac_channel *ch = &priv->channel[queue];
155157
156− napi_disable(&rx_q->napi);
158+ napi_disable(&ch->napi);
157159 }
158160 }
159161
@@ -164,12 +166,14 @@ static void stmmac_disable_all_queues(struct stmmac_priv *priv) · 4 unmodified lines
164166 static void stmmac_enable_all_queues(struct stmmac_priv *priv)
165167 {
166168 u32 rx_queues_cnt = priv->plat->rx_queues_to_use;
169+ u32 tx_queues_cnt = priv->plat->tx_queues_to_use;
170+ u32 maxq = max(rx_queues_cnt, tx_queues_cnt);
167171 u32 queue;
168172
169− for (queue = 0; queue < rx_queues_cnt; queue++) {
170− struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
173+ for (queue = 0; queue < maxq; queue++) {
174+ struct stmmac_channel *ch = &priv->channel[queue];
171175
172− napi_enable(&rx_q->napi);
176+ napi_enable(&ch->napi);
173177 }
174178 }
175179
@@ -1843,18 +1847,18 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) · 1667 unmodified lines
18431847 * @queue: TX queue index
18441848 * Description: it reclaims the transmit resources after transmission completes.
18451849 */
1846−static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
1850+static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
18471851 {
18481852 struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
18491853 unsigned int bytes_compl = 0, pkts_compl = 0;
1850− unsigned int entry;
1854+ unsigned int entry, count = 0;
18511855
1852− netif_tx_lock(priv->dev);
1856+ __netif_tx_lock_bh(netdev_get_tx_queue(priv->dev, queue));
18531857
18541858 priv->xstats.tx_clean++;
18551859
18561860 entry = tx_q->dirty_tx;
1857− while (entry != tx_q->cur_tx) {
1861+ while ((entry != tx_q->cur_tx) && (count < budget)) {
18581862 struct sk_buff *skb = tx_q->tx_skbuff[entry];
18591863 struct dma_desc *p;
18601864 int status;
@@ -1870,6 +1874,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) · 9 unmodified lines
18701874 if (unlikely(status & tx_dma_own))
18711875 break;
18721876
1877+ count++;
1878+
18731879 /* Make sure descriptor fields are read after reading
18741880 * the own bit.
18751881 */
@@ -1937,7 +1943,10 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) · 61 unmodified lines
19371943 stmmac_enable_eee_mode(priv);
19381944 mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer));
19391945 }
1940− netif_tx_unlock(priv->dev);
1946+
1947+ __netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue));
1948+
1949+ return count;
19411950 }
19421951
19431952 /**
@@ -2020,6 +2029,33 @@ static bool stmmac_safety_feat_interrupt(struct stmmac_priv *priv) · 76 unmodified lines
20202029 return false;
20212030 }
20222031
2032+static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
2033+{
2034+ int status = stmmac_dma_interrupt_status(priv, priv->ioaddr,
2035+ &priv->xstats, chan);
2036+ struct stmmac_channel *ch = &priv->channel[chan];
2037+ bool needs_work = false;
2038+
2039+ if ((status & handle_rx) && ch->has_rx) {
2040+ needs_work = true;
2041+ } else {
2042+ status &= ~handle_rx;
2043+ }
2044+
2045+ if ((status & handle_tx) && ch->has_tx) {
2046+ needs_work = true;
2047+ } else {
2048+ status &= ~handle_tx;
2049+ }
2050+
2051+ if (needs_work && napi_schedule_prep(&ch->napi)) {
2052+ stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
2053+ __napi_schedule(&ch->napi);
2054+ }
2055+
2056+ return status;
2057+}
2058+
20232059 /**
20242060 * stmmac_dma_interrupt - DMA ISR
20252061 * @priv: driver private structure
@@ -2034,57 +2070,14 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv) · 8 unmodified lines
20342070 u32 channels_to_check = tx_channel_count > rx_channel_count ?
20352071 tx_channel_count : rx_channel_count;
20362072 u32 chan;
2037− bool poll_scheduled = false;
20382073 int status[max_t(u32, MTL_MAX_TX_QUEUES, MTL_MAX_RX_QUEUES)];
20392074
20402075 /* Make sure we never check beyond our status buffer. */
20412076 if (WARN_ON_ONCE(channels_to_check > ARRAY_SIZE(status)))
20422077 channels_to_check = ARRAY_SIZE(status);
20432078
2044− /* Each DMA channel can be used for rx and tx simultaneously, yet
2045− * napi_struct is embedded in struct stmmac_rx_queue rather than in a
2046− * stmmac_channel struct.
2047− * Because of this, stmmac_poll currently checks (and possibly wakes)
2048− * all tx queues rather than just a single tx queue.
2049− */
20502079 for (chan = 0; chan < channels_to_check; chan++)
2051− status[chan] = stmmac_dma_interrupt_status(priv, priv->ioaddr,
2052− &priv->xstats, chan);
2053−
2054− for (chan = 0; chan < rx_channel_count; chan++) {
2055− if (likely(status[chan] & handle_rx)) {
2056− struct stmmac_rx_queue *rx_q = &priv->rx_queue[chan];
2057−
2058− if (likely(napi_schedule_prep(&rx_q->napi))) {
2059− stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
2060− __napi_schedule(&rx_q->napi);
2061− poll_scheduled = true;
2062− }
2063− }
2064− }
2065−
2066− /* If we scheduled poll, we already know that tx queues will be checked.
2067− * If we didn't schedule poll, see if any DMA channel (used by tx) has a
2068− * completed transmission, if so, call stmmac_poll (once).
2069− */
2070− if (!poll_scheduled) {
2071− for (chan = 0; chan < tx_channel_count; chan++) {
2072− if (status[chan] & handle_tx) {
2073− /* It doesn't matter what rx queue we choose
2074− * here. We use 0 since it always exists.
2075− */
2076− struct stmmac_rx_queue *rx_q =
2077− &priv->rx_queue[0];
2078−
2079− if (likely(napi_schedule_prep(&rx_q->napi))) {
2080− stmmac_disable_dma_irq(priv,
2081− priv->ioaddr, chan);
2082− __napi_schedule(&rx_q->napi);
2083− }
2084− break;
2085− }
2086− }
2087− }
2080+ status[chan] = stmmac_napi_check(priv, chan);
20882081
20892082 for (chan = 0; chan < tx_channel_count; chan++) {
20902083 if (unlikely(status[chan] & tx_hard_error_bump_tc)) {
@@ -2220,8 +2213,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) · 129 unmodified lines
22202213 stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
22212214 tx_q->dma_tx_phy, chan);
22222215
2223− tx_q->tx_tail_addr = tx_q->dma_tx_phy +
2224− (DMA_TX_SIZE * sizeof(struct dma_desc));
2216+ tx_q->tx_tail_addr = tx_q->dma_tx_phy;
22252217 stmmac_set_tx_tail_ptr(priv, priv->ioaddr,
22262218 tx_q->tx_tail_addr, chan);
22272219 }
@@ -2233,6 +2225,13 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) · 5 unmodified lines
22332225 return ret;
22342226 }
22352227
2228+static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
2229+{
2230+ struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
2231+
2232+ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer));
2233+}
2234+
22362235 /**
22372236 * stmmac_tx_timer - mitigation sw timer for tx.
22382237 * @data: data pointer
@@ -2241,13 +2240,14 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) · 2 unmodified lines
22412240 */
22422241 static void stmmac_tx_timer(struct timer_list *t)
22432242 {
2244− struct stmmac_priv *priv = from_timer(priv, t, txtimer);
2245− u32 tx_queues_count = priv->plat->tx_queues_to_use;
2246− u32 queue;
2243+ struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer);
2244+ struct stmmac_priv *priv = tx_q->priv_data;
2245+ struct stmmac_channel *ch;
2246+
2247+ ch = &priv->channel[tx_q->queue_index];
22472248
2248− /* let's scan all the tx queues */
2249− for (queue = 0; queue < tx_queues_count; queue++)
2250− stmmac_tx_clean(priv, queue);
2249+ if (likely(napi_schedule_prep(&ch->napi)))
2250+ __napi_schedule(&ch->napi);
22512251 }
22522252
22532253 /**
@@ -2260,11 +2260,17 @@ static void stmmac_tx_timer(struct timer_list *t) · 6 unmodified lines
22602260 */
22612261 static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
22622262 {
2263+ u32 tx_channel_count = priv->plat->tx_queues_to_use;
2264+ u32 chan;
2265+
22632266 priv->tx_coal_frames = STMMAC_TX_FRAMES;
22642267 priv->tx_coal_timer = STMMAC_COAL_TX_TIMER;
2265− timer_setup(&priv->txtimer, stmmac_tx_timer, 0);
2266− priv->txtimer.expires = STMMAC_COAL_TIMER(priv->tx_coal_timer);
2267− add_timer(&priv->txtimer);
2268+
2269+ for (chan = 0; chan < tx_channel_count; chan++) {
2270+ struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
2271+
2272+ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0);
2273+ }
22682274 }
22692275
22702276 static void stmmac_set_rings_length(struct stmmac_priv *priv)
@@ -2592,6 +2598,7 @@ static void stmmac_hw_teardown(struct net_device *dev) · 321 unmodified lines
25922598 static int stmmac_open(struct net_device *dev)
25932599 {
25942600 struct stmmac_priv *priv = netdev_priv(dev);
2601+ u32 chan;
25952602 int ret;
25962603
25972604 stmmac_check_ether_addr(priv);
@@ -2688,7 +2695,9 @@ irq_error: · 90 unmodified lines
26882695 if (dev->phydev)
26892696 phy_stop(dev->phydev);
26902697
2691− del_timer_sync(&priv->txtimer);
2698+ for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
2699+ del_timer_sync(&priv->tx_queue[chan].txtimer);
2700+
26922701 stmmac_hw_teardown(dev);
26932702 init_error:
26942703 free_dma_desc_resources(priv);
@@ -2708,6 +2717,7 @@ dma_desc_error: · 13 unmodified lines
27082717 static int stmmac_release(struct net_device *dev)
27092718 {
27102719 struct stmmac_priv *priv = netdev_priv(dev);
2720+ u32 chan;
27112721
27122722 if (priv->eee_enabled)
27132723 del_timer_sync(&priv->eee_ctrl_timer);
@@ -2722,7 +2732,8 @@ static int stmmac_release(struct net_device *dev) · 8 unmodified lines
27222732
27232733 stmmac_disable_all_queues(priv);
27242734
2725− del_timer_sync(&priv->txtimer);
2735+ for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
2736+ del_timer_sync(&priv->tx_queue[chan].txtimer);
27262737
27272738 /* Free the IRQ lines */
27282739 free_irq(dev->irq, dev);
@@ -2936,14 +2947,13 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 207 unmodified lines
29362947 priv->xstats.tx_tso_nfrags += nfrags;
29372948
29382949 /* Manage tx mitigation */
2939− priv->tx_count_frames += nfrags + 1;
2940− if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
2941− mod_timer(&priv->txtimer,
2942− STMMAC_COAL_TIMER(priv->tx_coal_timer));
2943− } else {
2944− priv->tx_count_frames = 0;
2950+ tx_q->tx_count_frames += nfrags + 1;
2951+ if (priv->tx_coal_frames <= tx_q->tx_count_frames) {
29452952 stmmac_set_tx_ic(priv, desc);
29462953 priv->xstats.tx_set_ic_bit++;
2954+ tx_q->tx_count_frames = 0;
2955+ } else {
2956+ stmmac_tx_timer_arm(priv, queue);
29472957 }
29482958
29492959 skb_tx_timestamp(skb);
@@ -2992,6 +3002,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 42 unmodified lines
29923002
29933003 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
29943004
3005+ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
29953006 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
29963007
29973008 return NETDEV_TX_OK;
@@ -3146,14 +3157,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 148 unmodified lines
31463157 * This approach takes care about the fragments: desc is the first
31473158 * element in case of no SG.
31483159 */
3149− priv->tx_count_frames += nfrags + 1;
3150− if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
3151− mod_timer(&priv->txtimer,
3152− STMMAC_COAL_TIMER(priv->tx_coal_timer));
3153− } else {
3154− priv->tx_count_frames = 0;
3160+ tx_q->tx_count_frames += nfrags + 1;
3161+ if (priv->tx_coal_frames <= tx_q->tx_count_frames) {
31553162 stmmac_set_tx_ic(priv, desc);
31563163 priv->xstats.tx_set_ic_bit++;
3164+ tx_q->tx_count_frames = 0;
3165+ } else {
3166+ stmmac_tx_timer_arm(priv, queue);
31573167 }
31583168
31593169 skb_tx_timestamp(skb);
@@ -3199,6 +3209,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 39 unmodified lines
31993209 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
32003210
32013211 stmmac_enable_dma_transmission(priv, priv->ioaddr);
3212+
3213+ tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
32023214 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
32033215
32043216 return NETDEV_TX_OK;
@@ -3319,6 +3331,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 114 unmodified lines
33193331 static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
33203332 {
33213333 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
3334+ struct stmmac_channel *ch = &priv->channel[queue];
33223335 unsigned int entry = rx_q->cur_rx;
33233336 int coe = priv->hw->rx_csum;
33243337 unsigned int next_entry;
@@ -3491,7 +3504,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 166 unmodified lines
34913504 else
34923505 skb->ip_summed = CHECKSUM_UNNECESSARY;
34933506
3494− napi_gro_receive(&rx_q->napi, skb);
3507+ napi_gro_receive(&ch->napi, skb);
34953508
34963509 priv->dev->stats.rx_packets++;
34973510 priv->dev->stats.rx_bytes += frame_len;
@@ -3514,27 +3527,33 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 16 unmodified lines
35143527 * Description :
35153528 * To look at the incoming frames and clear the tx resources.
35163529 */
3517−static int stmmac_poll(struct napi_struct *napi, int budget)
3530+static int stmmac_napi_poll(struct napi_struct *napi, int budget)
35183531 {
3519− struct stmmac_rx_queue *rx_q =
3520− container_of(napi, struct stmmac_rx_queue, napi);
3521− struct stmmac_priv *priv = rx_q->priv_data;
3522− u32 tx_count = priv->plat->tx_queues_to_use;
3523− u32 chan = rx_q->queue_index;
3524− int work_done = 0;
3525− u32 queue;
3532+ struct stmmac_channel *ch =
3533+ container_of(napi, struct stmmac_channel, napi);
3534+ struct stmmac_priv *priv = ch->priv_data;
3535+ int work_done = 0, work_rem = budget;
3536+ u32 chan = ch->index;
35263537
35273538 priv->xstats.napi_poll++;
35283539
3529− /* check all the queues */
3530− for (queue = 0; queue < tx_count; queue++)
3531− stmmac_tx_clean(priv, queue);
3540+ if (ch->has_tx) {
3541+ int done = stmmac_tx_clean(priv, work_rem, chan);
35323542
3533− work_done = stmmac_rx(priv, budget, rx_q->queue_index);
3534− if (work_done < budget) {
3535− napi_complete_done(napi, work_done);
3536− stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
3543+ work_done += done;
3544+ work_rem -= done;
3545+ }
3546+
3547+ if (ch->has_rx) {
3548+ int done = stmmac_rx(priv, work_rem, chan);
3549+
3550+ work_done += done;
3551+ work_rem -= done;
35373552 }
3553+
3554+ if (work_done < budget && napi_complete_done(napi, work_done))
3555+ stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
3556+
35383557 return work_done;
35393558 }
35403559
@@ -4198,8 +4217,8 @@ int stmmac_dvr_probe(struct device *device, · 657 unmodified lines
41984217 {
41994218 struct net_device *ndev = NULL;
42004219 struct stmmac_priv *priv;
4220+ u32 queue, maxq;
42014221 int ret = 0;
4202− u32 queue;
42034222
42044223 ndev = alloc_etherdev_mqs(sizeof(struct stmmac_priv),
42054224 MTL_MAX_TX_QUEUES,
@@ -4322,11 +4341,22 @@ int stmmac_dvr_probe(struct device *device, · 116 unmodified lines
43224341 "Enable RX Mitigation via HW Watchdog Timer\n");
43234342 }
43244343
4325− for (queue = 0; queue < priv->plat->rx_queues_to_use; queue++) {
4326− struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
4344+ /* Setup channels NAPI */
4345+ maxq = max(priv->plat->rx_queues_to_use, priv->plat->tx_queues_to_use);
43274346
4328− netif_napi_add(ndev, &rx_q->napi, stmmac_poll,
4329− (8 * priv->plat->rx_queues_to_use));
4347+ for (queue = 0; queue < maxq; queue++) {
4348+ struct stmmac_channel *ch = &priv->channel[queue];
4349+
4350+ ch->priv_data = priv;
4351+ ch->index = queue;
4352+
4353+ if (queue < priv->plat->rx_queues_to_use)
4354+ ch->has_rx = true;
4355+ if (queue < priv->plat->tx_queues_to_use)
4356+ ch->has_tx = true;
4357+
4358+ netif_napi_add(ndev, &ch->napi, stmmac_napi_poll,
4359+ NAPI_POLL_WEIGHT);
43304360 }
43314361
43324362 mutex_init(&priv->lock);
@@ -4372,10 +4402,10 @@ error_netdev_register: · 39 unmodified lines
43724402 priv->hw->pcs != STMMAC_PCS_RTBI)
43734403 stmmac_mdio_unregister(ndev);
43744404 error_mdio_register:
4375− for (queue = 0; queue < priv->plat->rx_queues_to_use; queue++) {
4376− struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
4405+ for (queue = 0; queue < maxq; queue++) {
4406+ struct stmmac_channel *ch = &priv->channel[queue];
43774407
4378− netif_napi_del(&rx_q->napi);
4408+ netif_napi_del(&ch->napi);
43794409 }
43804410 error_hw_init:
43814411 destroy_workqueue(priv->wq);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+2−3
@@ -67,7 +67,7 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins) · 66 unmodified lines
6767 * Description:
6868 * This function validates the number of Unicast address entries supported
6969 * by a particular Synopsys 10/100/1000 controller. The Synopsys controller
70− * supports 1, 32, 64, or 128 Unicast filter entries for it's Unicast filter
70+ * supports 1..32, 64, or 128 Unicast filter entries for it's Unicast filter
7171 * logic. This function validates a valid, supported configuration is
7272 * selected, and defaults to 1 Unicast address if an unsupported
7373 * configuration is selected.
@@ -77,8 +77,7 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) · 3 unmodified lines
7777 int x = ucast_entries;
7878
7979 switch (x) {
80− case 1:
81− case 32:
80+ case 1 ... 32:
8281 case 64:
8382 case 128:
8483 break;
drivers/net/ethernet/ti/Kconfig+1−0
@@ -41,6 +41,7 @@ config TI_DAVINCI_MDIO · 40 unmodified lines
4141 config TI_DAVINCI_CPDMA
4242 tristate "TI DaVinci CPDMA Support"
4343 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
44+ select GENERIC_ALLOCATOR
4445 ---help---
4546 This driver supports TI's DaVinci CPDMA dma engine.
4647
drivers/net/ethernet/wiznet/w5100.c+1−1
@@ -835,7 +835,7 @@ static void w5100_tx_work(struct work_struct *work) · 834 unmodified lines
835835 w5100_tx_skb(priv->ndev, skb);
836836 }
837837
838−static int w5100_start_tx(struct sk_buff *skb, struct net_device *ndev)
838+static netdev_tx_t w5100_start_tx(struct sk_buff *skb, struct net_device *ndev)
839839 {
840840 struct w5100_priv *priv = netdev_priv(ndev);
841841
drivers/net/ethernet/wiznet/w5300.c+1−1
@@ -365,7 +365,7 @@ static void w5300_tx_timeout(struct net_device *ndev) · 364 unmodified lines
365365 netif_wake_queue(ndev);
366366 }
367367
368−static int w5300_start_tx(struct sk_buff *skb, struct net_device *ndev)
368+static netdev_tx_t w5300_start_tx(struct sk_buff *skb, struct net_device *ndev)
369369 {
370370 struct w5300_priv *priv = netdev_priv(ndev);
371371
drivers/net/hyperv/netvsc.c+3−0
@@ -1203,6 +1203,9 @@ static void netvsc_send_vf(struct net_device *ndev, · 1202 unmodified lines
12031203
12041204 net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
12051205 net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
1206+ netdev_info(ndev, "VF slot %u %s\n",
1207+ net_device_ctx->vf_serial,
1208+ net_device_ctx->vf_alloc ? "added" : "removed");
12061209 }
12071210
12081211 static void netvsc_receive_inband(struct net_device *ndev,
drivers/net/hyperv/netvsc_drv.c+36−31
@@ -1894,20 +1894,6 @@ out_unlock: · 1893 unmodified lines
18941894 rtnl_unlock();
18951895 }
18961896
1897−static struct net_device *get_netvsc_bymac(const u8 *mac)
1898−{
1899− struct net_device_context *ndev_ctx;
1900−
1901− list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) {
1902− struct net_device *dev = hv_get_drvdata(ndev_ctx->device_ctx);
1903−
1904− if (ether_addr_equal(mac, dev->perm_addr))
1905− return dev;
1906− }
1907−
1908− return NULL;
1909−}
1910−
19111897 static struct net_device *get_netvsc_byref(struct net_device *vf_netdev)
19121898 {
19131899 struct net_device_context *net_device_ctx;
@@ -2036,26 +2022,48 @@ static void netvsc_vf_setup(struct work_struct *w) · 122 unmodified lines
20362022 rtnl_unlock();
20372023 }
20382024
2025+/* Find netvsc by VMBus serial number.
2026+ * The PCI hyperv controller records the serial number as the slot.
2027+ */
2028+static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
2029+{
2030+ struct device *parent = vf_netdev->dev.parent;
2031+ struct net_device_context *ndev_ctx;
2032+ struct pci_dev *pdev;
2033+
2034+ if (!parent || !dev_is_pci(parent))
2035+ return NULL; /* not a PCI device */
2036+
2037+ pdev = to_pci_dev(parent);
2038+ if (!pdev->slot) {
2039+ netdev_notice(vf_netdev, "no PCI slot information\n");
2040+ return NULL;
2041+ }
2042+
2043+ list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) {
2044+ if (!ndev_ctx->vf_alloc)
2045+ continue;
2046+
2047+ if (ndev_ctx->vf_serial == pdev->slot->number)
2048+ return hv_get_drvdata(ndev_ctx->device_ctx);
2049+ }
2050+
2051+ netdev_notice(vf_netdev,
2052+ "no netdev found for slot %u\n", pdev->slot->number);
2053+ return NULL;
2054+}
2055+
20392056 static int netvsc_register_vf(struct net_device *vf_netdev)
20402057 {
2041− struct net_device *ndev;
20422058 struct net_device_context *net_device_ctx;
2043− struct device *pdev = vf_netdev->dev.parent;
20442059 struct netvsc_device *netvsc_dev;
2060+ struct net_device *ndev;
20452061 int ret;
20462062
20472063 if (vf_netdev->addr_len != ETH_ALEN)
20482064 return NOTIFY_DONE;
20492065
2050− if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev))
2051− return NOTIFY_DONE;
2052−
2053− /*
2054− * We will use the MAC address to locate the synthetic interface to
2055− * associate with the VF interface. If we don't find a matching
2056− * synthetic interface, move on.
2057− */
2058− ndev = get_netvsc_bymac(vf_netdev->perm_addr);
2066+ ndev = get_netvsc_byslot(vf_netdev);
20592067 if (!ndev)
20602068 return NOTIFY_DONE;
20612069
@@ -2272,17 +2280,15 @@ static int netvsc_remove(struct hv_device *dev) · 210 unmodified lines
22722280
22732281 cancel_delayed_work_sync(&ndev_ctx->dwork);
22742282
2275− rcu_read_lock();
2276− nvdev = rcu_dereference(ndev_ctx->nvdev);
2277−
2278− if (nvdev)
2283+ rtnl_lock();
2284+ nvdev = rtnl_dereference(ndev_ctx->nvdev);
2285+ if (nvdev)
22792286 cancel_work_sync(&nvdev->subchan_work);
22802287
22812288 /*
22822289 * Call to the vsc driver to let it know that the device is being
22832290 * removed. Also blocks mtu and channel changes.
22842291 */
2285− rtnl_lock();
22862292 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
22872293 if (vf_netdev)
22882294 netvsc_unregister_vf(vf_netdev);
@@ -2294,7 +2300,6 @@ static int netvsc_remove(struct hv_device *dev) · 5 unmodified lines
22942300 list_del(&ndev_ctx->list);
22952301
22962302 rtnl_unlock();
2297− rcu_read_unlock();
22982303
22992304 hv_set_drvdata(dev, NULL);
23002305
drivers/net/phy/sfp-bus.c+2−2
@@ -349,6 +349,7 @@ static int sfp_register_bus(struct sfp_bus *bus) · 348 unmodified lines
349349 }
350350 if (bus->started)
351351 bus->socket_ops->start(bus->sfp);
352+ bus->netdev->sfp_bus = bus;
352353 bus->registered = true;
353354 return 0;
354355 }
@@ -357,6 +358,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus) · 2 unmodified lines
357358 {
358359 const struct sfp_upstream_ops *ops = bus->upstream_ops;
359360
361+ bus->netdev->sfp_bus = NULL;
360362 if (bus->registered) {
361363 if (bus->started)
362364 bus->socket_ops->stop(bus->sfp);
@@ -438,7 +440,6 @@ static void sfp_upstream_clear(struct sfp_bus *bus) · 75 unmodified lines
438440 {
439441 bus->upstream_ops = NULL;
440442 bus->upstream = NULL;
441− bus->netdev->sfp_bus = NULL;
442443 bus->netdev = NULL;
443444 }
444445
@@ -467,7 +468,6 @@ struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, · 22 unmodified lines
467468 bus->upstream_ops = ops;
468469 bus->upstream = upstream;
469470 bus->netdev = ndev;
470− ndev->sfp_bus = bus;
471471
472472 if (bus->sfp) {
473473 ret = sfp_register_bus(bus);
drivers/net/ppp/pppoe.c+3−0
@@ -429,6 +429,9 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, · 428 unmodified lines
429429 if (!skb)
430430 goto out;
431431
432+ if (skb_mac_header_len(skb) < ETH_HLEN)
433+ goto drop;
434+
432435 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
433436 goto drop;
434437
drivers/net/tun.c+0−43
@@ -1153,43 +1153,6 @@ static netdev_features_t tun_net_fix_features(struct net_device *dev, · 1152 unmodified lines
11531153
11541154 return (features & tun->set_features) | (features & ~TUN_USER_FEATURES);
11551155 }
1156−#ifdef CONFIG_NET_POLL_CONTROLLER
1157−static void tun_poll_controller(struct net_device *dev)
1158−{
1159− /*
1160− * Tun only receives frames when:
1161− * 1) the char device endpoint gets data from user space
1162− * 2) the tun socket gets a sendmsg call from user space
1163− * If NAPI is not enabled, since both of those are synchronous
1164− * operations, we are guaranteed never to have pending data when we poll
1165− * for it so there is nothing to do here but return.
1166− * We need this though so netpoll recognizes us as an interface that
1167− * supports polling, which enables bridge devices in virt setups to
1168− * still use netconsole
1169− * If NAPI is enabled, however, we need to schedule polling for all
1170− * queues unless we are using napi_gro_frags(), which we call in
1171− * process context and not in NAPI context.
1172− */
1173− struct tun_struct *tun = netdev_priv(dev);
1174−
1175− if (tun->flags & IFF_NAPI) {
1176− struct tun_file *tfile;
1177− int i;
1178−
1179− if (tun_napi_frags_enabled(tun))
1180− return;
1181−
1182− rcu_read_lock();
1183− for (i = 0; i < tun->numqueues; i++) {
1184− tfile = rcu_dereference(tun->tfiles[i]);
1185− if (tfile->napi_enabled)
1186− napi_schedule(&tfile->napi);
1187− }
1188− rcu_read_unlock();
1189− }
1190− return;
1191−}
1192−#endif
11931156
11941157 static void tun_set_headroom(struct net_device *dev, int new_hr)
11951158 {
@@ -1283,9 +1246,6 @@ static const struct net_device_ops tun_netdev_ops = { · 87 unmodified lines
12831246 .ndo_start_xmit = tun_net_xmit,
12841247 .ndo_fix_features = tun_net_fix_features,
12851248 .ndo_select_queue = tun_select_queue,
1286−#ifdef CONFIG_NET_POLL_CONTROLLER
1287− .ndo_poll_controller = tun_poll_controller,
1288−#endif
12891249 .ndo_set_rx_headroom = tun_set_headroom,
12901250 .ndo_get_stats64 = tun_net_get_stats64,
12911251 };
@@ -1365,9 +1325,6 @@ static const struct net_device_ops tap_netdev_ops = { · 73 unmodified lines
13651325 .ndo_set_mac_address = eth_mac_addr,
13661326 .ndo_validate_addr = eth_validate_addr,
13671327 .ndo_select_queue = tun_select_queue,
1368−#ifdef CONFIG_NET_POLL_CONTROLLER
1369− .ndo_poll_controller = tun_poll_controller,
1370−#endif
13711328 .ndo_features_check = passthru_features_check,
13721329 .ndo_set_rx_headroom = tun_set_headroom,
13731330 .ndo_get_stats64 = tun_net_get_stats64,
drivers/net/usb/qmi_wwan.c+36−8
@@ -967,6 +967,13 @@ static const struct usb_device_id products[] = { · 966 unmodified lines
967967 USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
968968 .driver_info = (unsigned long)&qmi_wwan_info,
969969 },
970+ { /* Quectel EP06/EG06/EM06 */
971+ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0306,
972+ USB_CLASS_VENDOR_SPEC,
973+ USB_SUBCLASS_VENDOR_SPEC,
974+ 0xff),
975+ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
976+ },
970977
971978 /* 3. Combined interface devices matching on interface number */
972979 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
@@ -1206,13 +1213,13 @@ static const struct usb_device_id products[] = { · 233 unmodified lines
12061213 {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
12071214 {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */
12081215 {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */
1209− {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
1210− {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
1211− {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
1212− {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */
1213− {QMI_FIXED_INTF(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */
1214− {QMI_FIXED_INTF(0x1199, 0x907b, 10)}, /* Sierra Wireless EM74xx */
1215− {QMI_FIXED_INTF(0x1199, 0x9091, 8)}, /* Sierra Wireless EM7565 */
1216+ {QMI_QUIRK_SET_DTR(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
1217+ {QMI_QUIRK_SET_DTR(0x1199, 0x9071, 10)},/* Sierra Wireless MC74xx */
1218+ {QMI_QUIRK_SET_DTR(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
1219+ {QMI_QUIRK_SET_DTR(0x1199, 0x9079, 10)},/* Sierra Wireless EM74xx */
1220+ {QMI_QUIRK_SET_DTR(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */
1221+ {QMI_QUIRK_SET_DTR(0x1199, 0x907b, 10)},/* Sierra Wireless EM74xx */
1222+ {QMI_QUIRK_SET_DTR(0x1199, 0x9091, 8)}, /* Sierra Wireless EM7565 */
12161223 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
12171224 {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
12181225 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
@@ -1255,7 +1262,6 @@ static const struct usb_device_id products[] = { · 36 unmodified lines
12551262 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
12561263 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
12571264 {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
1258− {QMI_QUIRK_SET_DTR(0x2c7c, 0x0306, 4)}, /* Quectel EP06 Mini PCIe */
12591265
12601266 /* 4. Gobi 1000 devices */
12611267 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
@@ -1331,6 +1337,19 @@ static bool quectel_ec20_detected(struct usb_interface *intf) · 69 unmodified lines
13311337 return false;
13321338 }
13331339
1340+static bool quectel_ep06_diag_detected(struct usb_interface *intf)
1341+{
1342+ struct usb_device *dev = interface_to_usbdev(intf);
1343+ struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc;
1344+
1345+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c &&
1346+ le16_to_cpu(dev->descriptor.idProduct) == 0x0306 &&
1347+ intf_desc.bNumEndpoints == 2)
1348+ return true;
1349+
1350+ return false;
1351+}
1352+
13341353 static int qmi_wwan_probe(struct usb_interface *intf,
13351354 const struct usb_device_id *prod)
13361355 {
@@ -1365,6 +1384,15 @@ static int qmi_wwan_probe(struct usb_interface *intf, · 28 unmodified lines
13651384 return -ENODEV;
13661385 }
13671386
1387+ /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so
1388+ * we need to match on class/subclass/protocol. These values are
1389+ * identical for the diagnostic- and QMI-interface, but bNumEndpoints is
1390+ * different. Ignore the current interface if the number of endpoints
1391+ * the number for the diag interface (two).
1392+ */
1393+ if (quectel_ep06_diag_detected(intf))
1394+ return -ENODEV;
1395+
13681396 return usbnet_probe(intf, id);
13691397 }
13701398
drivers/net/veth.c+2−2
@@ -463,6 +463,8 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq, struct sk_buff *skb, · 462 unmodified lines
463463 int mac_len, delta, off;
464464 struct xdp_buff xdp;
465465
466+ skb_orphan(skb);
467+
466468 rcu_read_lock();
467469 xdp_prog = rcu_dereference(rq->xdp_prog);
468470 if (unlikely(!xdp_prog)) {
@@ -508,8 +510,6 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq, struct sk_buff *skb, · 39 unmodified lines
508510 skb_copy_header(nskb, skb);
509511 head_off = skb_headroom(nskb) - skb_headroom(skb);
510512 skb_headers_offset_update(nskb, head_off);
511− if (skb->sk)
512− skb_set_owner_w(nskb, skb->sk);
513513 consume_skb(skb);
514514 skb = nskb;
515515 }
drivers/net/xen-netfront.c+17−15
@@ -87,8 +87,7 @@ struct netfront_cb { · 86 unmodified lines
8787 /* IRQ name is queue name with "-tx" or "-rx" appended */
8888 #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
8989
90−static DECLARE_WAIT_QUEUE_HEAD(module_load_q);
91−static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
90+static DECLARE_WAIT_QUEUE_HEAD(module_wq);
9291
9392 struct netfront_stats {
9493 u64 packets;
@@ -909,7 +908,11 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 814 unmodified lines
909908 BUG_ON(pull_to <= skb_headlen(skb));
910909 __pskb_pull_tail(skb, pull_to - skb_headlen(skb));
911910 }
912− BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
911+ if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
912+ queue->rx.rsp_cons = ++cons;
913+ kfree_skb(nskb);
914+ return ~0U;
915+ }
913916
914917 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
915918 skb_frag_page(nfrag),
@@ -1046,6 +1049,8 @@ err: · 130 unmodified lines
10461049 skb->len += rx->status;
10471050
10481051 i = xennet_fill_frags(queue, skb, &tmpq);
1052+ if (unlikely(i == ~0U))
1053+ goto err;
10491054
10501055 if (rx->flags & XEN_NETRXF_csum_blank)
10511056 skb->ip_summed = CHECKSUM_PARTIAL;
@@ -1332,11 +1337,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) · 280 unmodified lines
13321337 netif_carrier_off(netdev);
13331338
13341339 xenbus_switch_state(dev, XenbusStateInitialising);
1335− wait_event(module_load_q,
1336− xenbus_read_driver_state(dev->otherend) !=
1337− XenbusStateClosed &&
1338− xenbus_read_driver_state(dev->otherend) !=
1339− XenbusStateUnknown);
1340+ wait_event(module_wq,
1341+ xenbus_read_driver_state(dev->otherend) !=
1342+ XenbusStateClosed &&
1343+ xenbus_read_driver_state(dev->otherend) !=
1344+ XenbusStateUnknown);
13401345 return netdev;
13411346
13421347 exit:
@@ -2010,15 +2015,14 @@ static void netback_changed(struct xenbus_device *dev, · 667 unmodified lines
20102015
20112016 dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
20122017
2018+ wake_up_all(&module_wq);
2019+
20132020 switch (backend_state) {
20142021 case XenbusStateInitialising:
20152022 case XenbusStateInitialised:
20162023 case XenbusStateReconfiguring:
20172024 case XenbusStateReconfigured:
2018− break;
2019−
20202025 case XenbusStateUnknown:
2021− wake_up_all(&module_unload_q);
20222026 break;
20232027
20242028 case XenbusStateInitWait:
@@ -2034,12 +2038,10 @@ static void netback_changed(struct xenbus_device *dev, · 9 unmodified lines
20342038 break;
20352039
20362040 case XenbusStateClosed:
2037− wake_up_all(&module_unload_q);
20382041 if (dev->state == XenbusStateClosed)
20392042 break;
20402043 /* Missed the backend's CLOSING state -- fallthrough */
20412044 case XenbusStateClosing:
2042− wake_up_all(&module_unload_q);
20432045 xenbus_frontend_closed(dev);
20442046 break;
20452047 }
@@ -2147,14 +2149,14 @@ static int xennet_remove(struct xenbus_device *dev) · 101 unmodified lines
21472149
21482150 if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
21492151 xenbus_switch_state(dev, XenbusStateClosing);
2150− wait_event(module_unload_q,
2152+ wait_event(module_wq,
21512153 xenbus_read_driver_state(dev->otherend) ==
21522154 XenbusStateClosing ||
21532155 xenbus_read_driver_state(dev->otherend) ==
21542156 XenbusStateUnknown);
21552157
21562158 xenbus_switch_state(dev, XenbusStateClosed);
2157− wait_event(module_unload_q,
2159+ wait_event(module_wq,
21582160 xenbus_read_driver_state(dev->otherend) ==
21592161 XenbusStateClosed ||
21602162 xenbus_read_driver_state(dev->otherend) ==
drivers/nvme/host/multipath.c+4−2
@@ -530,8 +530,10 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 529 unmodified lines
530530
531531 INIT_WORK(&ctrl->ana_work, nvme_ana_work);
532532 ctrl->ana_log_buf = kmalloc(ctrl->ana_log_size, GFP_KERNEL);
533− if (!ctrl->ana_log_buf)
533+ if (!ctrl->ana_log_buf) {
534+ error = -ENOMEM;
534535 goto out;
536+ }
535537
536538 error = nvme_read_ana_log(ctrl, true);
537539 if (error)
@@ -540,7 +542,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 2 unmodified lines
540542 out_free_ana_log_buf:
541543 kfree(ctrl->ana_log_buf);
542544 out:
543− return -ENOMEM;
545+ return error;
544546 }
545547
546548 void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
drivers/nvme/target/admin-cmd.c+4−0
@@ -245,6 +245,10 @@ static void nvmet_execute_get_log_page_ana(struct nvmet_req *req) · 244 unmodified lines
245245 offset += len;
246246 ngrps++;
247247 }
248+ for ( ; grpid <= NVMET_MAX_ANAGRPS; grpid++) {
249+ if (nvmet_ana_group_enabled[grpid])
250+ ngrps++;
251+ }
248252
249253 hdr.chgcnt = cpu_to_le64(nvmet_ana_chgcnt);
250254 hdr.ngrps = cpu_to_le16(ngrps);
drivers/nvme/target/rdma.c+25−2
@@ -66,6 +66,7 @@ struct nvmet_rdma_rsp { · 65 unmodified lines
6666
6767 struct nvmet_req req;
6868
69+ bool allocated;
6970 u8 n_rdma;
7071 u32 flags;
7172 u32 invalidate_rkey;
@@ -174,11 +175,19 @@ nvmet_rdma_get_rsp(struct nvmet_rdma_queue *queue) · 102 unmodified lines
174175 unsigned long flags;
175176
176177 spin_lock_irqsave(&queue->rsps_lock, flags);
177− rsp = list_first_entry(&queue->free_rsps,
178+ rsp = list_first_entry_or_null(&queue->free_rsps,
178179 struct nvmet_rdma_rsp, free_list);
179− list_del(&rsp->free_list);
180+ if (likely(rsp))
181+ list_del(&rsp->free_list);
180182 spin_unlock_irqrestore(&queue->rsps_lock, flags);
181183
184+ if (unlikely(!rsp)) {
185+ rsp = kmalloc(sizeof(*rsp), GFP_KERNEL);
186+ if (unlikely(!rsp))
187+ return NULL;
188+ rsp->allocated = true;
189+ }
190+
182191 return rsp;
183192 }
184193
@@ -187,6 +196,11 @@ nvmet_rdma_put_rsp(struct nvmet_rdma_rsp *rsp) · 2 unmodified lines
187196 {
188197 unsigned long flags;
189198
199+ if (rsp->allocated) {
200+ kfree(rsp);
201+ return;
202+ }
203+
190204 spin_lock_irqsave(&rsp->queue->rsps_lock, flags);
191205 list_add_tail(&rsp->free_list, &rsp->queue->free_rsps);
192206 spin_unlock_irqrestore(&rsp->queue->rsps_lock, flags);
@@ -776,6 +790,15 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 583 unmodified lines
776790
777791 cmd->queue = queue;
778792 rsp = nvmet_rdma_get_rsp(queue);
793+ if (unlikely(!rsp)) {
794+ /*
795+ * we get here only under memory pressure,
796+ * silently drop and have the host retry
797+ * as we can't even fail it.
798+ */
799+ nvmet_rdma_post_recv(queue->dev, cmd);
800+ return;
801+ }
779802 rsp->queue = queue;
780803 rsp->cmd = cmd;
781804 rsp->flags = 0;
drivers/of/base.c+3−0
@@ -140,6 +140,9 @@ void of_populate_phandle_cache(void) · 139 unmodified lines
140140 if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL)
141141 phandles++;
142142
143+ if (!phandles)
144+ goto out;
145+
143146 cache_entries = roundup_pow_of_two(phandles);
144147 phandle_cache_mask = cache_entries - 1;
145148
drivers/pci/controller/dwc/pcie-designware.c+4−4
@@ -135,7 +135,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, int index, · 134 unmodified lines
135135 if (val & PCIE_ATU_ENABLE)
136136 return;
137137
138− usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX);
138+ mdelay(LINK_WAIT_IATU);
139139 }
140140 dev_err(pci->dev, "Outbound iATU is not being enabled\n");
141141 }
@@ -178,7 +178,7 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, · 36 unmodified lines
178178 if (val & PCIE_ATU_ENABLE)
179179 return;
180180
181− usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX);
181+ mdelay(LINK_WAIT_IATU);
182182 }
183183 dev_err(pci->dev, "Outbound iATU is not being enabled\n");
184184 }
@@ -236,7 +236,7 @@ static int dw_pcie_prog_inbound_atu_unroll(struct dw_pcie *pci, int index, · 51 unmodified lines
236236 if (val & PCIE_ATU_ENABLE)
237237 return 0;
238238
239− usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX);
239+ mdelay(LINK_WAIT_IATU);
240240 }
241241 dev_err(pci->dev, "Inbound iATU is not being enabled\n");
242242
@@ -282,7 +282,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int bar, · 39 unmodified lines
282282 if (val & PCIE_ATU_ENABLE)
283283 return 0;
284284
285− usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX);
285+ mdelay(LINK_WAIT_IATU);
286286 }
287287 dev_err(pci->dev, "Inbound iATU is not being enabled\n");
288288
drivers/pci/controller/dwc/pcie-designware.h+1−2
@@ -26,8 +26,7 @@ · 25 unmodified lines
2626
2727 /* Parameters for the waiting for iATU enabled routine */
2828 #define LINK_WAIT_MAX_IATU_RETRIES 5
29−#define LINK_WAIT_IATU_MIN 9000
30−#define LINK_WAIT_IATU_MAX 10000
29+#define LINK_WAIT_IATU 9
3130
3231 /* Synopsys-specific PCIe configuration registers */
3332 #define PCIE_PORT_LINK_CONTROL 0x710
drivers/pci/controller/pci-hyperv.c+39−0
@@ -89,6 +89,9 @@ static enum pci_protocol_version_t pci_protocol_version; · 88 unmodified lines
8989
9090 #define STATUS_REVISION_MISMATCH 0xC0000059
9191
92+/* space for 32bit serial number as string */
93+#define SLOT_NAME_SIZE 11
94+
9295 /*
9396 * Message Types
9497 */
@@ -494,6 +497,7 @@ struct hv_pci_dev { · 399 unmodified lines
494497 struct list_head list_entry;
495498 refcount_t refs;
496499 enum hv_pcichild_state state;
500+ struct pci_slot *pci_slot;
497501 struct pci_function_description desc;
498502 bool reported_missing;
499503 struct hv_pcibus_device *hbus;
@@ -1457,6 +1461,36 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus) · 957 unmodified lines
14571461 spin_unlock_irqrestore(&hbus->device_list_lock, flags);
14581462 }
14591463
1464+/*
1465+ * Assign entries in sysfs pci slot directory.
1466+ *
1467+ * Note that this function does not need to lock the children list
1468+ * because it is called from pci_devices_present_work which
1469+ * is serialized with hv_eject_device_work because they are on the
1470+ * same ordered workqueue. Therefore hbus->children list will not change
1471+ * even when pci_create_slot sleeps.
1472+ */
1473+static void hv_pci_assign_slots(struct hv_pcibus_device *hbus)
1474+{
1475+ struct hv_pci_dev *hpdev;
1476+ char name[SLOT_NAME_SIZE];
1477+ int slot_nr;
1478+
1479+ list_for_each_entry(hpdev, &hbus->children, list_entry) {
1480+ if (hpdev->pci_slot)
1481+ continue;
1482+
1483+ slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot));
1484+ snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser);
1485+ hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr,
1486+ name, NULL);
1487+ if (IS_ERR(hpdev->pci_slot)) {
1488+ pr_warn("pci_create slot %s failed\n", name);
1489+ hpdev->pci_slot = NULL;
1490+ }
1491+ }
1492+}
1493+
14601494 /**
14611495 * create_root_hv_pci_bus() - Expose a new root PCI bus
14621496 * @hbus: Root PCI bus, as understood by this driver
@@ -1480,6 +1514,7 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) · 17 unmodified lines
14801514 pci_lock_rescan_remove();
14811515 pci_scan_child_bus(hbus->pci_bus);
14821516 pci_bus_assign_resources(hbus->pci_bus);
1517+ hv_pci_assign_slots(hbus);
14831518 pci_bus_add_devices(hbus->pci_bus);
14841519 pci_unlock_rescan_remove();
14851520 hbus->state = hv_pcibus_installed;
@@ -1742,6 +1777,7 @@ static void pci_devices_present_work(struct work_struct *work) · 256 unmodified lines
17421777 */
17431778 pci_lock_rescan_remove();
17441779 pci_scan_child_bus(hbus->pci_bus);
1780+ hv_pci_assign_slots(hbus);
17451781 pci_unlock_rescan_remove();
17461782 break;
17471783
@@ -1858,6 +1894,9 @@ static void hv_eject_device_work(struct work_struct *work) · 110 unmodified lines
18581894 list_del(&hpdev->list_entry);
18591895 spin_unlock_irqrestore(&hpdev->hbus->device_list_lock, flags);
18601896
1897+ if (hpdev->pci_slot)
1898+ pci_destroy_slot(hpdev->pci_slot);
1899+
18611900 memset(&ctxt, 0, sizeof(ctxt));
18621901 ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message;
18631902 ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE;
drivers/pci/hotplug/acpiphp_glue.c+6−5
@@ -457,17 +457,18 @@ static void acpiphp_native_scan_bridge(struct pci_dev *bridge) · 456 unmodified lines
457457 /**
458458 * enable_slot - enable, configure a slot
459459 * @slot: slot to be enabled
460+ * @bridge: true if enable is for the whole bridge (not a single slot)
460461 *
461462 * This function should be called per *physical slot*,
462463 * not per each slot object in ACPI namespace.
463464 */
464−static void enable_slot(struct acpiphp_slot *slot)
465+static void enable_slot(struct acpiphp_slot *slot, bool bridge)
465466 {
466467 struct pci_dev *dev;
467468 struct pci_bus *bus = slot->bus;
468469 struct acpiphp_func *func;
469470
470− if (bus->self && hotplug_is_native(bus->self)) {
471+ if (bridge && bus->self && hotplug_is_native(bus->self)) {
471472 /*
472473 * If native hotplug is used, it will take care of hotplug
473474 * slot management and resource allocation for hotplug
@@ -701,7 +702,7 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) · 227 unmodified lines
701702 trim_stale_devices(dev);
702703
703704 /* configure all functions */
704− enable_slot(slot);
705+ enable_slot(slot, true);
705706 } else {
706707 disable_slot(slot);
707708 }
@@ -785,7 +786,7 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) · 77 unmodified lines
785786 if (bridge)
786787 acpiphp_check_bridge(bridge);
787788 else if (!(slot->flags & SLOT_IS_GOING_AWAY))
788− enable_slot(slot);
789+ enable_slot(slot, false);
789790
790791 break;
791792
@@ -973,7 +974,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) · 181 unmodified lines
973974
974975 /* configure all functions */
975976 if (!(slot->flags & SLOT_ENABLED))
976− enable_slot(slot);
977+ enable_slot(slot, false);
977978
978979 pci_unlock_rescan_remove();
979980 return 0;
drivers/pci/hotplug/pciehp_hpc.c+9−9
@@ -496,7 +496,7 @@ int pciehp_power_on_slot(struct slot *slot) · 495 unmodified lines
496496 u16 slot_status;
497497 int retval;
498498
499− /* Clear sticky power-fault bit from previous power failures */
499+ /* Clear power-fault bit from previous power failures */
500500 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
501501 if (slot_status & PCI_EXP_SLTSTA_PFD)
502502 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
@@ -646,6 +646,14 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) · 143 unmodified lines
646646 pciehp_handle_button_press(slot);
647647 }
648648
649+ /* Check Power Fault Detected */
650+ if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) {
651+ ctrl->power_fault_detected = 1;
652+ ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(slot));
653+ pciehp_set_attention_status(slot, 1);
654+ pciehp_green_led_off(slot);
655+ }
656+
649657 /*
650658 * Disable requests have higher priority than Presence Detect Changed
651659 * or Data Link Layer State Changed events.
@@ -657,14 +665,6 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) · 5 unmodified lines
657665 pciehp_handle_presence_or_link_change(slot, events);
658666 up_read(&ctrl->reset_lock);
659667
660− /* Check Power Fault Detected */
661− if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) {
662− ctrl->power_fault_detected = 1;
663− ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(slot));
664− pciehp_set_attention_status(slot, 1);
665− pciehp_green_led_off(slot);
666− }
667−
668668 pci_config_pm_runtime_put(pdev);
669669 wake_up(&ctrl->requester);
670670 return IRQ_HANDLED;
drivers/pci/pci.c+2−1
@@ -4547,6 +4547,7 @@ int pci_bridge_secondary_bus_reset(struct pci_dev *dev) · 4546 unmodified lines
45474547
45484548 return pci_dev_wait(dev, "bus reset", PCIE_RESET_READY_POLL_MS);
45494549 }
4550+EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset);
45504551
45514552 static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
45524553 {
@@ -5200,7 +5201,7 @@ static int __pci_reset_bus(struct pci_bus *bus) · 647 unmodified lines
52005201 */
52015202 int pci_reset_bus(struct pci_dev *pdev)
52025203 {
5203− return pci_probe_reset_slot(pdev->slot) ?
5204+ return (!pci_probe_reset_slot(pdev->slot)) ?
52045205 __pci_reset_slot(pdev->slot) : __pci_reset_bus(pdev->bus);
52055206 }
52065207 EXPORT_SYMBOL_GPL(pci_reset_bus);
drivers/pci/probe.c+4−1
@@ -2074,6 +2074,7 @@ static void pci_configure_eetlp_prefix(struct pci_dev *dev) · 2073 unmodified lines
20742074 {
20752075 #ifdef CONFIG_PCI_PASID
20762076 struct pci_dev *bridge;
2077+ int pcie_type;
20772078 u32 cap;
20782079
20792080 if (!pci_is_pcie(dev))
@@ -2083,7 +2084,9 @@ static void pci_configure_eetlp_prefix(struct pci_dev *dev) · 3 unmodified lines
20832084 if (!(cap & PCI_EXP_DEVCAP2_EE_PREFIX))
20842085 return;
20852086
2086− if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
2087+ pcie_type = pci_pcie_type(dev);
2088+ if (pcie_type == PCI_EXP_TYPE_ROOT_PORT ||
2089+ pcie_type == PCI_EXP_TYPE_RC_END)
20872090 dev->eetlp_prefix_path = 1;
20882091 else {
20892092 bridge = pci_upstream_bridge(dev);
drivers/pci/quirks.c+0−6
@@ -4355,11 +4355,6 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) · 4354 unmodified lines
43554355 *
43564356 * 0x9d10-0x9d1b PCI Express Root port #{1-12}
43574357 *
4358− * The 300 series chipset suffers from the same bug so include those root
4359− * ports here as well.
4360− *
4361− * 0xa32c-0xa343 PCI Express Root port #{0-24}
4362− *
43634358 * [1] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html
43644359 * [2] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html
43654360 * [3] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html
@@ -4377,7 +4372,6 @@ static bool pci_quirk_intel_spt_pch_acs_match(struct pci_dev *dev) · 11 unmodified lines
43774372 case 0xa110 ... 0xa11f: case 0xa167 ... 0xa16a: /* Sunrise Point */
43784373 case 0xa290 ... 0xa29f: case 0xa2e7 ... 0xa2ee: /* Union Point */
43794374 case 0x9d10 ... 0x9d1b: /* 7th & 8th Gen Mobile */
4380− case 0xa32c ... 0xa343: /* 300 series */
43814375 return true;
43824376 }
43834377
drivers/pci/switch/switchtec.c+4−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414 #include <linux/poll.h>
1515 #include <linux/wait.h>
1616
17+#include <linux/nospec.h>
18+
1719 MODULE_DESCRIPTION("Microsemi Switchtec(tm) PCIe Management Driver");
1820 MODULE_VERSION("0.1");
1921 MODULE_LICENSE("GPL");
@@ -909,6 +911,8 @@ static int ioctl_port_to_pff(struct switchtec_dev *stdev, · 889 unmodified lines
909911 default:
910912 if (p.port > ARRAY_SIZE(pcfg->dsp_pff_inst_id))
911913 return -EINVAL;
914+ p.port = array_index_nospec(p.port,
915+ ARRAY_SIZE(pcfg->dsp_pff_inst_id) + 1);
912916 p.pff = ioread32(&pcfg->dsp_pff_inst_id[p.port - 1]);
913917 break;
914918 }
drivers/pinctrl/cirrus/pinctrl-madera-core.c+1−1
@@ -1040,7 +1040,7 @@ static int madera_pin_probe(struct platform_device *pdev) · 1039 unmodified lines
10401040 }
10411041
10421042 /* if the configuration is provided through pdata, apply it */
1043− if (pdata) {
1043+ if (pdata && pdata->gpio_configs) {
10441044 ret = pinctrl_register_mappings(pdata->gpio_configs,
10451045 pdata->n_gpio_configs);
10461046 if (ret) {
drivers/pinctrl/intel/pinctrl-cannonlake.c+21−14
@@ -15,10 +15,11 @@ · 14 unmodified lines
1515
1616 #include "pinctrl-intel.h"
1717
18−#define CNL_PAD_OWN 0x020
19−#define CNL_PADCFGLOCK 0x080
20−#define CNL_HOSTSW_OWN 0x0b0
21−#define CNL_GPI_IE 0x120
18+#define CNL_PAD_OWN 0x020
19+#define CNL_PADCFGLOCK 0x080
20+#define CNL_LP_HOSTSW_OWN 0x0b0
21+#define CNL_H_HOSTSW_OWN 0x0c0
22+#define CNL_GPI_IE 0x120
2223
2324 #define CNL_GPP(r, s, e, g) \
2425 { \
@@ -30,12 +31,12 @@ · 5 unmodified lines
3031
3132 #define CNL_NO_GPIO -1
3233
33−#define CNL_COMMUNITY(b, s, e, g) \
34+#define CNL_COMMUNITY(b, s, e, o, g) \
3435 { \
3536 .barno = (b), \
3637 .padown_offset = CNL_PAD_OWN, \
3738 .padcfglock_offset = CNL_PADCFGLOCK, \
38− .hostown_offset = CNL_HOSTSW_OWN, \
39+ .hostown_offset = (o), \
3940 .ie_offset = CNL_GPI_IE, \
4041 .pin_base = (s), \
4142 .npins = ((e) - (s) + 1), \
@@ -43,6 +44,12 @@ · 1 unmodified line
4344 .ngpps = ARRAY_SIZE(g), \
4445 }
4546
47+#define CNLLP_COMMUNITY(b, s, e, g) \
48+ CNL_COMMUNITY(b, s, e, CNL_LP_HOSTSW_OWN, g)
49+
50+#define CNLH_COMMUNITY(b, s, e, g) \
51+ CNL_COMMUNITY(b, s, e, CNL_H_HOSTSW_OWN, g)
52+
4653 /* Cannon Lake-H */
4754 static const struct pinctrl_pin_desc cnlh_pins[] = {
4855 /* GPP_A */
@@ -379,7 +386,7 @@ static const struct intel_padgroup cnlh_community1_gpps[] = { · 330 unmodified lines
379386 static const struct intel_padgroup cnlh_community3_gpps[] = {
380387 CNL_GPP(0, 155, 178, 192), /* GPP_K */
381388 CNL_GPP(1, 179, 202, 224), /* GPP_H */
382− CNL_GPP(2, 203, 215, 258), /* GPP_E */
389+ CNL_GPP(2, 203, 215, 256), /* GPP_E */
383390 CNL_GPP(3, 216, 239, 288), /* GPP_F */
384391 CNL_GPP(4, 240, 248, CNL_NO_GPIO), /* SPI */
385392 };
@@ -442,10 +449,10 @@ static const struct intel_function cnlh_functions[] = { · 56 unmodified lines
442449 };
443450
444451 static const struct intel_community cnlh_communities[] = {
445− CNL_COMMUNITY(0, 0, 50, cnlh_community0_gpps),
446− CNL_COMMUNITY(1, 51, 154, cnlh_community1_gpps),
447− CNL_COMMUNITY(2, 155, 248, cnlh_community3_gpps),
448− CNL_COMMUNITY(3, 249, 298, cnlh_community4_gpps),
452+ CNLH_COMMUNITY(0, 0, 50, cnlh_community0_gpps),
453+ CNLH_COMMUNITY(1, 51, 154, cnlh_community1_gpps),
454+ CNLH_COMMUNITY(2, 155, 248, cnlh_community3_gpps),
455+ CNLH_COMMUNITY(3, 249, 298, cnlh_community4_gpps),
449456 };
450457
451458 static const struct intel_pinctrl_soc_data cnlh_soc_data = {
@@ -803,9 +810,9 @@ static const struct intel_padgroup cnllp_community4_gpps[] = { · 351 unmodified lines
803810 };
804811
805812 static const struct intel_community cnllp_communities[] = {
806− CNL_COMMUNITY(0, 0, 67, cnllp_community0_gpps),
807− CNL_COMMUNITY(1, 68, 180, cnllp_community1_gpps),
808− CNL_COMMUNITY(2, 181, 243, cnllp_community4_gpps),
813+ CNLLP_COMMUNITY(0, 0, 67, cnllp_community0_gpps),
814+ CNLLP_COMMUNITY(1, 68, 180, cnllp_community1_gpps),
815+ CNLLP_COMMUNITY(2, 181, 243, cnllp_community4_gpps),
809816 };
810817
811818 static const struct intel_pinctrl_soc_data cnllp_soc_data = {
drivers/pinctrl/intel/pinctrl-intel.c+63−80
@@ -747,13 +747,63 @@ static const struct pinctrl_desc intel_pinctrl_desc = { · 746 unmodified lines
747747 .owner = THIS_MODULE,
748748 };
749749
750+/**
751+ * intel_gpio_to_pin() - Translate from GPIO offset to pin number
752+ * @pctrl: Pinctrl structure
753+ * @offset: GPIO offset from gpiolib
754+ * @commmunity: Community is filled here if not %NULL
755+ * @padgrp: Pad group is filled here if not %NULL
756+ *
757+ * When coming through gpiolib irqchip, the GPIO offset is not
758+ * automatically translated to pinctrl pin number. This function can be
759+ * used to find out the corresponding pinctrl pin.
760+ */
761+static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned offset,
762+ const struct intel_community **community,
763+ const struct intel_padgroup **padgrp)
764+{
765+ int i;
766+
767+ for (i = 0; i < pctrl->ncommunities; i++) {
768+ const struct intel_community *comm = &pctrl->communities[i];
769+ int j;
770+
771+ for (j = 0; j < comm->ngpps; j++) {
772+ const struct intel_padgroup *pgrp = &comm->gpps[j];
773+
774+ if (pgrp->gpio_base < 0)
775+ continue;
776+
777+ if (offset >= pgrp->gpio_base &&
778+ offset < pgrp->gpio_base + pgrp->size) {
779+ int pin;
780+
781+ pin = pgrp->base + offset - pgrp->gpio_base;
782+ if (community)
783+ *community = comm;
784+ if (padgrp)
785+ *padgrp = pgrp;
786+
787+ return pin;
788+ }
789+ }
790+ }
791+
792+ return -EINVAL;
793+}
794+
750795 static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)
751796 {
752797 struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
753798 void __iomem *reg;
754799 u32 padcfg0;
800+ int pin;
755801
756− reg = intel_get_padcfg(pctrl, offset, PADCFG0);
802+ pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
803+ if (pin < 0)
804+ return -EINVAL;
805+
806+ reg = intel_get_padcfg(pctrl, pin, PADCFG0);
757807 if (!reg)
758808 return -EINVAL;
759809
@@ -770,8 +820,13 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 10 unmodified lines
770820 unsigned long flags;
771821 void __iomem *reg;
772822 u32 padcfg0;
823+ int pin;
773824
774− reg = intel_get_padcfg(pctrl, offset, PADCFG0);
825+ pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
826+ if (pin < 0)
827+ return;
828+
829+ reg = intel_get_padcfg(pctrl, pin, PADCFG0);
775830 if (!reg)
776831 return;
777832
@@ -790,8 +845,13 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) · 12 unmodified lines
790845 struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
791846 void __iomem *reg;
792847 u32 padcfg0;
848+ int pin;
793849
794− reg = intel_get_padcfg(pctrl, offset, PADCFG0);
850+ pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
851+ if (pin < 0)
852+ return -EINVAL;
853+
854+ reg = intel_get_padcfg(pctrl, pin, PADCFG0);
795855 if (!reg)
796856 return -EINVAL;
797857
@@ -827,81 +887,6 @@ static const struct gpio_chip intel_gpio_chip = { · 29 unmodified lines
827887 .set_config = gpiochip_generic_config,
828888 };
829889
830−/**
831− * intel_gpio_to_pin() - Translate from GPIO offset to pin number
832− * @pctrl: Pinctrl structure
833− * @offset: GPIO offset from gpiolib
834− * @commmunity: Community is filled here if not %NULL
835− * @padgrp: Pad group is filled here if not %NULL
836− *
837− * When coming through gpiolib irqchip, the GPIO offset is not
838− * automatically translated to pinctrl pin number. This function can be
839− * used to find out the corresponding pinctrl pin.
840− */
841−static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned offset,
842− const struct intel_community **community,
843− const struct intel_padgroup **padgrp)
844−{
845− int i;
846−
847− for (i = 0; i < pctrl->ncommunities; i++) {
848− const struct intel_community *comm = &pctrl->communities[i];
849− int j;
850−
851− for (j = 0; j < comm->ngpps; j++) {
852− const struct intel_padgroup *pgrp = &comm->gpps[j];
853−
854− if (pgrp->gpio_base < 0)
855− continue;
856−
857− if (offset >= pgrp->gpio_base &&
858− offset < pgrp->gpio_base + pgrp->size) {
859− int pin;
860−
861− pin = pgrp->base + offset - pgrp->gpio_base;
862− if (community)
863− *community = comm;
864− if (padgrp)
865− *padgrp = pgrp;
866−
867− return pin;
868− }
869− }
870− }
871−
872− return -EINVAL;
873−}
874−
875−static int intel_gpio_irq_reqres(struct irq_data *d)
876−{
877− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
878− struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
879− int pin;
880− int ret;
881−
882− pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), NULL, NULL);
883− if (pin >= 0) {
884− ret = gpiochip_lock_as_irq(gc, pin);
885− if (ret) {
886− dev_err(pctrl->dev, "unable to lock HW IRQ %d for IRQ\n",
887− pin);
888− return ret;
889− }
890− }
891− return 0;
892−}
893−
894−static void intel_gpio_irq_relres(struct irq_data *d)
895−{
896− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
897− struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
898− int pin;
899−
900− pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), NULL, NULL);
901− if (pin >= 0)
902− gpiochip_unlock_as_irq(gc, pin);
903−}
904−
905890 static void intel_gpio_irq_ack(struct irq_data *d)
906891 {
907892 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -1117,8 +1102,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 209 unmodified lines
11171102
11181103 static struct irq_chip intel_gpio_irqchip = {
11191104 .name = "intel-gpio",
1120− .irq_request_resources = intel_gpio_irq_reqres,
1121− .irq_release_resources = intel_gpio_irq_relres,
11221105 .irq_enable = intel_gpio_irq_enable,
11231106 .irq_ack = intel_gpio_irq_ack,
11241107 .irq_mask = intel_gpio_irq_mask,
drivers/pinctrl/pinctrl-amd.c+23−10
@@ -348,21 +348,12 @@ static void amd_gpio_irq_enable(struct irq_data *d) · 347 unmodified lines
348348 unsigned long flags;
349349 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
350350 struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
351− u32 mask = BIT(INTERRUPT_ENABLE_OFF) | BIT(INTERRUPT_MASK_OFF);
352351
353352 raw_spin_lock_irqsave(&gpio_dev->lock, flags);
354353 pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
355354 pin_reg |= BIT(INTERRUPT_ENABLE_OFF);
356355 pin_reg |= BIT(INTERRUPT_MASK_OFF);
357356 writel(pin_reg, gpio_dev->base + (d->hwirq)*4);
358− /*
359− * When debounce logic is enabled it takes ~900 us before interrupts
360− * can be enabled. During this "debounce warm up" period the
361− * "INTERRUPT_ENABLE" bit will read as 0. Poll the bit here until it
362− * reads back as 1, signaling that interrupts are now enabled.
363− */
364− while ((readl(gpio_dev->base + (d->hwirq)*4) & mask) != mask)
365− continue;
366357 raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
367358 }
368359
@@ -426,7 +417,7 @@ static void amd_gpio_irq_eoi(struct irq_data *d) · 57 unmodified lines
426417 static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
427418 {
428419 int ret = 0;
429− u32 pin_reg;
420+ u32 pin_reg, pin_reg_irq_en, mask;
430421 unsigned long flags, irq_flags;
431422 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
432423 struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
@@ -495,6 +486,28 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) · 62 unmodified lines
495486 }
496487
497488 pin_reg |= CLR_INTR_STAT << INTERRUPT_STS_OFF;
489+ /*
490+ * If WAKE_INT_MASTER_REG.MaskStsEn is set, a software write to the
491+ * debounce registers of any GPIO will block wake/interrupt status
492+ * generation for *all* GPIOs for a lenght of time that depends on
493+ * WAKE_INT_MASTER_REG.MaskStsLength[11:0]. During this period the
494+ * INTERRUPT_ENABLE bit will read as 0.
495+ *
496+ * We temporarily enable irq for the GPIO whose configuration is
497+ * changing, and then wait for it to read back as 1 to know when
498+ * debounce has settled and then disable the irq again.
499+ * We do this polling with the spinlock held to ensure other GPIO
500+ * access routines do not read an incorrect value for the irq enable
501+ * bit of other GPIOs. We keep the GPIO masked while polling to avoid
502+ * spurious irqs, and disable the irq again after polling.
503+ */
504+ mask = BIT(INTERRUPT_ENABLE_OFF);
505+ pin_reg_irq_en = pin_reg;
506+ pin_reg_irq_en |= mask;
507+ pin_reg_irq_en &= ~BIT(INTERRUPT_MASK_OFF);
508+ writel(pin_reg_irq_en, gpio_dev->base + (d->hwirq)*4);
509+ while ((readl(gpio_dev->base + (d->hwirq)*4) & mask) != mask)
510+ continue;
498511 writel(pin_reg, gpio_dev->base + (d->hwirq)*4);
499512 raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
500513
drivers/pinctrl/pinctrl-ingenic.c+2−2
@@ -793,7 +793,7 @@ static int ingenic_pinctrl_probe(struct platform_device *pdev) · 792 unmodified lines
793793
794794 err = pinctrl_generic_add_group(jzpc->pctl, group->name,
795795 group->pins, group->num_pins, group->data);
796− if (err) {
796+ if (err < 0) {
797797 dev_err(dev, "Failed to register group %s\n",
798798 group->name);
799799 return err;
@@ -806,7 +806,7 @@ static int ingenic_pinctrl_probe(struct platform_device *pdev) · 6 unmodified lines
806806 err = pinmux_generic_add_function(jzpc->pctl, func->name,
807807 func->group_names, func->num_group_names,
808808 func->data);
809− if (err) {
809+ if (err < 0) {
810810 dev_err(dev, "Failed to register function %s\n",
811811 func->name);
812812 return err;
drivers/pinctrl/qcom/pinctrl-msm.c+24−0
@@ -634,6 +634,29 @@ static void msm_gpio_irq_mask(struct irq_data *d) · 633 unmodified lines
634634 raw_spin_lock_irqsave(&pctrl->lock, flags);
635635
636636 val = readl(pctrl->regs + g->intr_cfg_reg);
637+ /*
638+ * There are two bits that control interrupt forwarding to the CPU. The
639+ * RAW_STATUS_EN bit causes the level or edge sensed on the line to be
640+ * latched into the interrupt status register when the hardware detects
641+ * an irq that it's configured for (either edge for edge type or level
642+ * for level type irq). The 'non-raw' status enable bit causes the
643+ * hardware to assert the summary interrupt to the CPU if the latched
644+ * status bit is set. There's a bug though, the edge detection logic
645+ * seems to have a problem where toggling the RAW_STATUS_EN bit may
646+ * cause the status bit to latch spuriously when there isn't any edge
647+ * so we can't touch that bit for edge type irqs and we have to keep
648+ * the bit set anyway so that edges are latched while the line is masked.
649+ *
650+ * To make matters more complicated, leaving the RAW_STATUS_EN bit
651+ * enabled all the time causes level interrupts to re-latch into the
652+ * status register because the level is still present on the line after
653+ * we ack it. We clear the raw status enable bit during mask here and
654+ * set the bit on unmask so the interrupt can't latch into the hardware
655+ * while it's masked.
656+ */
657+ if (irqd_get_trigger_type(d) & IRQ_TYPE_LEVEL_MASK)
658+ val &= ~BIT(g->intr_raw_status_bit);
659+
637660 val &= ~BIT(g->intr_enable_bit);
638661 writel(val, pctrl->regs + g->intr_cfg_reg);
639662
@@ -655,6 +678,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d) · 15 unmodified lines
655678 raw_spin_lock_irqsave(&pctrl->lock, flags);
656679
657680 val = readl(pctrl->regs + g->intr_cfg_reg);
681+ val |= BIT(g->intr_raw_status_bit);
658682 val |= BIT(g->intr_enable_bit);
659683 writel(val, pctrl->regs + g->intr_cfg_reg);
660684
drivers/platform/x86/alienware-wmi.c+1−0
@@ -536,6 +536,7 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, · 535 unmodified lines
536536 if (obj && obj->type == ACPI_TYPE_INTEGER)
537537 *out_data = (u32) obj->integer.value;
538538 }
539+ kfree(output.pointer);
539540 return status;
540541
541542 }
drivers/platform/x86/dell-smbios-wmi.c+1−0
@@ -78,6 +78,7 @@ static int run_smbios_call(struct wmi_device *wdev) · 77 unmodified lines
7878 dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n",
7979 priv->buf->std.output[0], priv->buf->std.output[1],
8080 priv->buf->std.output[2], priv->buf->std.output[3]);
81+ kfree(output.pointer);
8182
8283 return 0;
8384 }
drivers/regulator/bd71837-regulator.c+19−0
@@ -569,6 +569,25 @@ static int bd71837_probe(struct platform_device *pdev) · 568 unmodified lines
569569 BD71837_REG_REGLOCK);
570570 }
571571
572+ /*
573+ * There is a HW quirk in BD71837. The shutdown sequence timings for
574+ * bucks/LDOs which are controlled via register interface are changed.
575+ * At PMIC poweroff the voltage for BUCK6/7 is cut immediately at the
576+ * beginning of shut-down sequence. As bucks 6 and 7 are parent
577+ * supplies for LDO5 and LDO6 - this causes LDO5/6 voltage
578+ * monitoring to errorneously detect under voltage and force PMIC to
579+ * emergency state instead of poweroff. In order to avoid this we
580+ * disable voltage monitoring for LDO5 and LDO6
581+ */
582+ err = regmap_update_bits(pmic->mfd->regmap, BD718XX_REG_MVRFLTMASK2,
583+ BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80,
584+ BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80);
585+ if (err) {
586+ dev_err(&pmic->pdev->dev,
587+ "Failed to disable voltage monitoring\n");
588+ goto err;
589+ }
590+
572591 for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) {
573592
574593 struct regulator_desc *desc;
drivers/regulator/core.c+2−2
@@ -3161,7 +3161,7 @@ static inline int regulator_suspend_toggle(struct regulator_dev *rdev, · 3160 unmodified lines
31613161 if (!rstate->changeable)
31623162 return -EPERM;
31633163
3164− rstate->enabled = en;
3164+ rstate->enabled = (en) ? ENABLE_IN_SUSPEND : DISABLE_IN_SUSPEND;
31653165
31663166 return 0;
31673167 }
@@ -4395,13 +4395,13 @@ regulator_register(const struct regulator_desc *regulator_desc, · 1227 unmodified lines
43954395 !rdev->desc->fixed_uV)
43964396 rdev->is_switch = true;
43974397
4398+ dev_set_drvdata(&rdev->dev, rdev);
43984399 ret = device_register(&rdev->dev);
43994400 if (ret != 0) {
44004401 put_device(&rdev->dev);
44014402 goto unset_supplies;
44024403 }
44034404
4404− dev_set_drvdata(&rdev->dev, rdev);
44054405 rdev_init_debugfs(rdev);
44064406
44074407 /* try to resolve regulators supply since a new one was registered */
drivers/regulator/of_regulator.c+0−2
@@ -213,8 +213,6 @@ static void of_get_regulation_constraints(struct device_node *np, · 212 unmodified lines
213213 else if (of_property_read_bool(suspend_np,
214214 "regulator-off-in-suspend"))
215215 suspend_state->enabled = DISABLE_IN_SUSPEND;
216− else
217− suspend_state->enabled = DO_NOTHING_IN_SUSPEND;
218216
219217 if (!of_property_read_u32(np, "regulator-suspend-min-microvolt",
220218 &pval))
drivers/s390/crypto/ap_bus.c+33−53
@@ -872,8 +872,6 @@ static int hex2bitmap(const char *str, unsigned long *bitmap, int bits) · 871 unmodified lines
872872 if (bits & 0x07)
873873 return -EINVAL;
874874
875− memset(bitmap, 0, bits / 8);
876−
877875 if (str[0] == '0' && str[1] == 'x')
878876 str++;
879877 if (*str == 'x')
@@ -895,25 +893,23 @@ static int hex2bitmap(const char *str, unsigned long *bitmap, int bits) · 15 unmodified lines
895893 }
896894
897895 /*
898− * str2clrsetmasks() - parse bitmask argument and set the clear and
899− * the set bitmap mask. A concatenation (done with ',') of these terms
900− * is recognized:
896+ * modify_bitmap() - parse bitmask argument and modify an existing
897+ * bit mask accordingly. A concatenation (done with ',') of these
898+ * terms is recognized:
901899 * +<bitnr>[-<bitnr>] or -<bitnr>[-<bitnr>]
902900 * <bitnr> may be any valid number (hex, decimal or octal) in the range
903901 * 0...bits-1; the leading + or - is required. Here are some examples:
904902 * +0-15,+32,-128,-0xFF
905903 * -0-255,+1-16,+0x128
906904 * +1,+2,+3,+4,-5,-7-10
907− * Returns a clear and a set bitmask. Every positive value in the string
908− * results in a bit set in the set mask and every negative value in the
909− * string results in a bit SET in the clear mask. As a bit may be touched
910− * more than once, the last 'operation' wins: +0-255,-128 = all but bit
911− * 128 set in the set mask, only bit 128 set in the clear mask.
905+ * Returns the new bitmap after all changes have been applied. Every
906+ * positive value in the string will set a bit and every negative value
907+ * in the string will clear a bit. As a bit may be touched more than once,
908+ * the last 'operation' wins:
909+ * +0-255,-128 = first bits 0-255 will be set, then bit 128 will be
910+ * cleared again. All other bits are unmodified.
912911 */
913−static int str2clrsetmasks(const char *str,
914− unsigned long *clrmap,
915− unsigned long *setmap,
916− int bits)
912+static int modify_bitmap(const char *str, unsigned long *bitmap, int bits)
917913 {
918914 int a, i, z;
919915 char *np, sign;
@@ -922,9 +918,6 @@ static int str2clrsetmasks(const char *str, · 2 unmodified lines
922918 if (bits & 0x07)
923919 return -EINVAL;
924920
925− memset(clrmap, 0, bits / 8);
926− memset(setmap, 0, bits / 8);
927−
928921 while (*str) {
929922 sign = *str++;
930923 if (sign != '+' && sign != '-')
@@ -940,13 +933,10 @@ static int str2clrsetmasks(const char *str, · 9 unmodified lines
940933 str = np;
941934 }
942935 for (i = a; i <= z; i++)
943− if (sign == '+') {
944− set_bit_inv(i, setmap);
945− clear_bit_inv(i, clrmap);
946− } else {
947− clear_bit_inv(i, setmap);
948− set_bit_inv(i, clrmap);
949− }
936+ if (sign == '+')
937+ set_bit_inv(i, bitmap);
938+ else
939+ clear_bit_inv(i, bitmap);
950940 while (*str == ',' || *str == '\n')
951941 str++;
952942 }
@@ -970,44 +960,34 @@ static int process_mask_arg(const char *str, · 17 unmodified lines
970960 unsigned long *bitmap, int bits,
971961 struct mutex *lock)
972962 {
973− int i;
963+ unsigned long *newmap, size;
964+ int rc;
974965
975966 /* bits needs to be a multiple of 8 */
976967 if (bits & 0x07)
977968 return -EINVAL;
978969
970+ size = BITS_TO_LONGS(bits)*sizeof(unsigned long);
971+ newmap = kmalloc(size, GFP_KERNEL);
972+ if (!newmap)
973+ return -ENOMEM;
974+ if (mutex_lock_interruptible(lock)) {
975+ kfree(newmap);
976+ return -ERESTARTSYS;
977+ }
978+
979979 if (*str == '+' || *str == '-') {
980− DECLARE_BITMAP(clrm, bits);
981− DECLARE_BITMAP(setm, bits);
982−
983− i = str2clrsetmasks(str, clrm, setm, bits);
984− if (i)
985− return i;
986− if (mutex_lock_interruptible(lock))
987− return -ERESTARTSYS;
988− for (i = 0; i < bits; i++) {
989− if (test_bit_inv(i, clrm))
990− clear_bit_inv(i, bitmap);
991− if (test_bit_inv(i, setm))
992− set_bit_inv(i, bitmap);
993− }
980+ memcpy(newmap, bitmap, size);
981+ rc = modify_bitmap(str, newmap, bits);
994982 } else {
995− DECLARE_BITMAP(setm, bits);
996−
997− i = hex2bitmap(str, setm, bits);
998− if (i)
999− return i;
1000− if (mutex_lock_interruptible(lock))
1001− return -ERESTARTSYS;
1002− for (i = 0; i < bits; i++)
1003− if (test_bit_inv(i, setm))
1004− set_bit_inv(i, bitmap);
1005− else
1006− clear_bit_inv(i, bitmap);
983+ memset(newmap, 0, size);
984+ rc = hex2bitmap(str, newmap, bits);
1007985 }
986+ if (rc == 0)
987+ memcpy(bitmap, newmap, size);
1008988 mutex_unlock(lock);
1009−
1010− return 0;
989+ kfree(newmap);
990+ return rc;
1011991 }
1012992
1013993 /*
drivers/s390/net/qeth_core_main.c+8−3
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/netdevice.h>
2626 #include <linux/netdev_features.h>
2727 #include <linux/skbuff.h>
28+#include <linux/vmalloc.h>
2829
2930 #include <net/iucv/af_iucv.h>
3031 #include <net/dsfield.h>
@@ -4699,7 +4700,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) · 4668 unmodified lines
46994700
47004701 priv.buffer_len = oat_data.buffer_len;
47014702 priv.response_len = 0;
4702− priv.buffer = kzalloc(oat_data.buffer_len, GFP_KERNEL);
4703+ priv.buffer = vzalloc(oat_data.buffer_len);
47034704 if (!priv.buffer) {
47044705 rc = -ENOMEM;
47054706 goto out;
@@ -4740,7 +4741,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) · 34 unmodified lines
47404741 rc = -EFAULT;
47414742
47424743 out_free:
4743− kfree(priv.buffer);
4744+ vfree(priv.buffer);
47444745 out:
47454746 return rc;
47464747 }
@@ -5706,6 +5707,8 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card) · 959 unmodified lines
57065707 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
57075708 dev->hw_features |= NETIF_F_SG;
57085709 dev->vlan_features |= NETIF_F_SG;
5710+ if (IS_IQD(card))
5711+ dev->features |= NETIF_F_SG;
57095712 }
57105713
57115714 return dev;
@@ -5768,8 +5771,10 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) · 56 unmodified lines
57685771 qeth_update_from_chp_desc(card);
57695772
57705773 card->dev = qeth_alloc_netdev(card);
5771− if (!card->dev)
5774+ if (!card->dev) {
5775+ rc = -ENOMEM;
57725776 goto err_card;
5777+ }
57735778
57745779 qeth_determine_capabilities(card);
57755780 enforced_disc = qeth_enforce_discipline(card);
drivers/s390/net/qeth_l2_main.c+1−1
@@ -423,7 +423,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card, · 422 unmodified lines
423423 default:
424424 dev_kfree_skb_any(skb);
425425 QETH_CARD_TEXT(card, 3, "inbunkno");
426− QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
426+ QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
427427 continue;
428428 }
429429 work_done++;
drivers/s390/net/qeth_l3_main.c+1−1
@@ -1390,7 +1390,7 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, · 1389 unmodified lines
13901390 default:
13911391 dev_kfree_skb_any(skb);
13921392 QETH_CARD_TEXT(card, 3, "inbunkno");
1393− QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
1393+ QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
13941394 continue;
13951395 }
13961396 work_done++;
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c+2−3
@@ -3474,11 +3474,10 @@ static int ibmvscsis_probe(struct vio_dev *vdev, · 3473 unmodified lines
34743474 vscsi->dds.window[LOCAL].liobn,
34753475 vscsi->dds.window[REMOTE].liobn);
34763476
3477− strcpy(vscsi->eye, "VSCSI ");
3478− strncat(vscsi->eye, vdev->name, MAX_EYE);
3477+ snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name);
34793478
34803479 vscsi->dds.unit_id = vdev->unit_address;
3481− strncpy(vscsi->dds.partition_name, partition_name,
3480+ strscpy(vscsi->dds.partition_name, partition_name,
34823481 sizeof(vscsi->dds.partition_name));
34833482 vscsi->dds.partition_num = partition_number;
34843483
drivers/scsi/ipr.c+61−45
@@ -3335,6 +3335,65 @@ static void ipr_release_dump(struct kref *kref) · 3334 unmodified lines
33353335 LEAVE;
33363336 }
33373337
3338+static void ipr_add_remove_thread(struct work_struct *work)
3339+{
3340+ unsigned long lock_flags;
3341+ struct ipr_resource_entry *res;
3342+ struct scsi_device *sdev;
3343+ struct ipr_ioa_cfg *ioa_cfg =
3344+ container_of(work, struct ipr_ioa_cfg, scsi_add_work_q);
3345+ u8 bus, target, lun;
3346+ int did_work;
3347+
3348+ ENTER;
3349+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
3350+
3351+restart:
3352+ do {
3353+ did_work = 0;
3354+ if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) {
3355+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3356+ return;
3357+ }
3358+
3359+ list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
3360+ if (res->del_from_ml && res->sdev) {
3361+ did_work = 1;
3362+ sdev = res->sdev;
3363+ if (!scsi_device_get(sdev)) {
3364+ if (!res->add_to_ml)
3365+ list_move_tail(&res->queue, &ioa_cfg->free_res_q);
3366+ else
3367+ res->del_from_ml = 0;
3368+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3369+ scsi_remove_device(sdev);
3370+ scsi_device_put(sdev);
3371+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
3372+ }
3373+ break;
3374+ }
3375+ }
3376+ } while (did_work);
3377+
3378+ list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
3379+ if (res->add_to_ml) {
3380+ bus = res->bus;
3381+ target = res->target;
3382+ lun = res->lun;
3383+ res->add_to_ml = 0;
3384+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3385+ scsi_add_device(ioa_cfg->host, bus, target, lun);
3386+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
3387+ goto restart;
3388+ }
3389+ }
3390+
3391+ ioa_cfg->scan_done = 1;
3392+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3393+ kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE);
3394+ LEAVE;
3395+}
3396+
33383397 /**
33393398 * ipr_worker_thread - Worker thread
33403399 * @work: ioa config struct
@@ -3349,13 +3408,9 @@ static void ipr_release_dump(struct kref *kref) · 8 unmodified lines
33493408 static void ipr_worker_thread(struct work_struct *work)
33503409 {
33513410 unsigned long lock_flags;
3352− struct ipr_resource_entry *res;
3353− struct scsi_device *sdev;
33543411 struct ipr_dump *dump;
33553412 struct ipr_ioa_cfg *ioa_cfg =
33563413 container_of(work, struct ipr_ioa_cfg, work_q);
3357− u8 bus, target, lun;
3358− int did_work;
33593414
33603415 ENTER;
33613416 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
@@ -3393,49 +3448,9 @@ static void ipr_worker_thread(struct work_struct *work) · 31 unmodified lines
33933448 return;
33943449 }
33953450
3396−restart:
3397− do {
3398− did_work = 0;
3399− if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) {
3400− spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3401− return;
3402− }
3451+ schedule_work(&ioa_cfg->scsi_add_work_q);
34033452
3404− list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
3405− if (res->del_from_ml && res->sdev) {
3406− did_work = 1;
3407− sdev = res->sdev;
3408− if (!scsi_device_get(sdev)) {
3409− if (!res->add_to_ml)
3410− list_move_tail(&res->queue, &ioa_cfg->free_res_q);
3411− else
3412− res->del_from_ml = 0;
3413− spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3414− scsi_remove_device(sdev);
3415− scsi_device_put(sdev);
3416− spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
3417− }
3418− break;
3419− }
3420− }
3421− } while (did_work);
3422−
3423− list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
3424− if (res->add_to_ml) {
3425− bus = res->bus;
3426− target = res->target;
3427− lun = res->lun;
3428− res->add_to_ml = 0;
3429− spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3430− scsi_add_device(ioa_cfg->host, bus, target, lun);
3431− spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
3432− goto restart;
3433− }
3434− }
3435−
3436− ioa_cfg->scan_done = 1;
34373453 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3438− kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE);
34393454 LEAVE;
34403455 }
34413456
@@ -9933,6 +9948,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, · 6491 unmodified lines
99339948 INIT_LIST_HEAD(&ioa_cfg->free_res_q);
99349949 INIT_LIST_HEAD(&ioa_cfg->used_res_q);
99359950 INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread);
9951+ INIT_WORK(&ioa_cfg->scsi_add_work_q, ipr_add_remove_thread);
99369952 init_waitqueue_head(&ioa_cfg->reset_wait_q);
99379953 init_waitqueue_head(&ioa_cfg->msi_wait_q);
99389954 init_waitqueue_head(&ioa_cfg->eeh_wait_q);
drivers/scsi/ipr.h+1−0
@@ -1575,6 +1575,7 @@ struct ipr_ioa_cfg { · 1574 unmodified lines
15751575 u8 saved_mode_page_len;
15761576
15771577 struct work_struct work_q;
1578+ struct work_struct scsi_add_work_q;
15781579 struct workqueue_struct *reset_work_q;
15791580
15801581 wait_queue_head_t reset_wait_q;
drivers/scsi/lpfc/lpfc_attr.c+10−5
@@ -360,12 +360,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, · 359 unmodified lines
360360 goto buffer_done;
361361
362362 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
363+ nrport = NULL;
364+ spin_lock(&vport->phba->hbalock);
363365 rport = lpfc_ndlp_get_nrport(ndlp);
364− if (!rport)
365− continue;
366−
367− /* local short-hand pointer. */
368− nrport = rport->remoteport;
366+ if (rport)
367+ nrport = rport->remoteport;
368+ spin_unlock(&vport->phba->hbalock);
369369 if (!nrport)
370370 continue;
371371
@@ -3386,6 +3386,7 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) · 3014 unmodified lines
33863386 struct lpfc_nodelist *ndlp;
33873387 #if (IS_ENABLED(CONFIG_NVME_FC))
33883388 struct lpfc_nvme_rport *rport;
3389+ struct nvme_fc_remote_port *remoteport = NULL;
33893390 #endif
33903391
33913392 shost = lpfc_shost_from_vport(vport);
@@ -3396,8 +3397,12 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) · 4 unmodified lines
33963397 if (ndlp->rport)
33973398 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;
33983399 #if (IS_ENABLED(CONFIG_NVME_FC))
3400+ spin_lock(&vport->phba->hbalock);
33993401 rport = lpfc_ndlp_get_nrport(ndlp);
34003402 if (rport)
3403+ remoteport = rport->remoteport;
3404+ spin_unlock(&vport->phba->hbalock);
3405+ if (remoteport)
34013406 nvme_fc_set_remoteport_devloss(rport->remoteport,
34023407 vport->cfg_devloss_tmo);
34033408 #endif
drivers/scsi/lpfc/lpfc_debugfs.c+5−5
@@ -551,7 +551,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 550 unmodified lines
551551 unsigned char *statep;
552552 struct nvme_fc_local_port *localport;
553553 struct lpfc_nvmet_tgtport *tgtp;
554− struct nvme_fc_remote_port *nrport;
554+ struct nvme_fc_remote_port *nrport = NULL;
555555 struct lpfc_nvme_rport *rport;
556556
557557 cnt = (LPFC_NODELIST_SIZE / LPFC_NODELIST_ENTRY_SIZE);
@@ -696,11 +696,11 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 138 unmodified lines
696696 len += snprintf(buf + len, size - len, "\tRport List:\n");
697697 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
698698 /* local short-hand pointer. */
699+ spin_lock(&phba->hbalock);
699700 rport = lpfc_ndlp_get_nrport(ndlp);
700− if (!rport)
701− continue;
702−
703− nrport = rport->remoteport;
701+ if (rport)
702+ nrport = rport->remoteport;
703+ spin_unlock(&phba->hbalock);
704704 if (!nrport)
705705 continue;
706706
drivers/scsi/lpfc/lpfc_nvme.c+8−3
@@ -2725,7 +2725,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 2724 unmodified lines
27252725 rpinfo.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
27262726 rpinfo.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
27272727
2728+ spin_lock_irq(&vport->phba->hbalock);
27282729 oldrport = lpfc_ndlp_get_nrport(ndlp);
2730+ spin_unlock_irq(&vport->phba->hbalock);
27292731 if (!oldrport)
27302732 lpfc_nlp_get(ndlp);
27312733
@@ -2840,7 +2842,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 108 unmodified lines
28402842 struct nvme_fc_local_port *localport;
28412843 struct lpfc_nvme_lport *lport;
28422844 struct lpfc_nvme_rport *rport;
2843− struct nvme_fc_remote_port *remoteport;
2845+ struct nvme_fc_remote_port *remoteport = NULL;
28442846
28452847 localport = vport->localport;
28462848
@@ -2854,11 +2856,14 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 7 unmodified lines
28542856 if (!lport)
28552857 goto input_err;
28562858
2859+ spin_lock_irq(&vport->phba->hbalock);
28572860 rport = lpfc_ndlp_get_nrport(ndlp);
2858− if (!rport)
2861+ if (rport)
2862+ remoteport = rport->remoteport;
2863+ spin_unlock_irq(&vport->phba->hbalock);
2864+ if (!remoteport)
28592865 goto input_err;
28602866
2861− remoteport = rport->remoteport;
28622867 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
28632868 "6033 Unreg nvme remoteport %p, portname x%llx, "
28642869 "port_id x%06x, portstate x%x port type x%x\n",
drivers/scsi/qedi/qedi.h+6−1
@@ -77,6 +77,11 @@ enum qedi_nvm_tgts { · 76 unmodified lines
7777 QEDI_NVM_TGT_SEC,
7878 };
7979
80+struct qedi_nvm_iscsi_image {
81+ struct nvm_iscsi_cfg iscsi_cfg;
82+ u32 crc;
83+};
84+
8085 struct qedi_uio_ctrl {
8186 /* meta data */
8287 u32 uio_hsi_version;
@@ -294,7 +299,7 @@ struct qedi_ctx { · 211 unmodified lines
294299 void *bdq_pbl_list;
295300 dma_addr_t bdq_pbl_list_dma;
296301 u8 bdq_pbl_list_num_entries;
297− struct nvm_iscsi_cfg *iscsi_cfg;
302+ struct qedi_nvm_iscsi_image *iscsi_image;
298303 dma_addr_t nvm_buf_dma;
299304 void __iomem *bdq_primary_prod;
300305 void __iomem *bdq_secondary_prod;
drivers/scsi/qedi/qedi_main.c+15−13
@@ -1346,23 +1346,26 @@ exit_setup_int: · 1345 unmodified lines
13461346
13471347 static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi)
13481348 {
1349− if (qedi->iscsi_cfg)
1349+ if (qedi->iscsi_image)
13501350 dma_free_coherent(&qedi->pdev->dev,
1351− sizeof(struct nvm_iscsi_cfg),
1352− qedi->iscsi_cfg, qedi->nvm_buf_dma);
1351+ sizeof(struct qedi_nvm_iscsi_image),
1352+ qedi->iscsi_image, qedi->nvm_buf_dma);
13531353 }
13541354
13551355 static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
13561356 {
1357− qedi->iscsi_cfg = dma_zalloc_coherent(&qedi->pdev->dev,
1358− sizeof(struct nvm_iscsi_cfg),
1359− &qedi->nvm_buf_dma, GFP_KERNEL);
1360− if (!qedi->iscsi_cfg) {
1357+ struct qedi_nvm_iscsi_image nvm_image;
1358+
1359+ qedi->iscsi_image = dma_zalloc_coherent(&qedi->pdev->dev,
1360+ sizeof(nvm_image),
1361+ &qedi->nvm_buf_dma,
1362+ GFP_KERNEL);
1363+ if (!qedi->iscsi_image) {
13611364 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
13621365 return -ENOMEM;
13631366 }
13641367 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1365− "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_cfg,
1368+ "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
13661369 qedi->nvm_buf_dma);
13671370
13681371 return 0;
@@ -1905,7 +1908,7 @@ qedi_get_nvram_block(struct qedi_ctx *qedi) · 536 unmodified lines
19051908 struct nvm_iscsi_block *block;
19061909
19071910 pf = qedi->dev_info.common.abs_pf_id;
1908− block = &qedi->iscsi_cfg->block[0];
1911+ block = &qedi->iscsi_image->iscsi_cfg.block[0];
19091912 for (i = 0; i < NUM_OF_ISCSI_PF_SUPPORTED; i++, block++) {
19101913 flags = ((block->id) & NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK) >>
19111914 NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET;
@@ -2194,15 +2197,14 @@ static void qedi_boot_release(void *data) · 282 unmodified lines
21942197 static int qedi_get_boot_info(struct qedi_ctx *qedi)
21952198 {
21962199 int ret = 1;
2197− u16 len;
2198−
2199− len = sizeof(struct nvm_iscsi_cfg);
2200+ struct qedi_nvm_iscsi_image nvm_image;
22002201
22012202 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
22022203 "Get NVM iSCSI CFG image\n");
22032204 ret = qedi_ops->common->nvm_get_image(qedi->cdev,
22042205 QED_NVM_IMAGE_ISCSI_CFG,
2205− (char *)qedi->iscsi_cfg, len);
2206+ (char *)qedi->iscsi_image,
2207+ sizeof(nvm_image));
22062208 if (ret)
22072209 QEDI_ERR(&qedi->dbg_ctx,
22082210 "Could not get NVM image. ret = %d\n", ret);
drivers/scsi/qla2xxx/qla_target.h+2−2
@@ -374,8 +374,8 @@ struct atio_from_isp { · 373 unmodified lines
374374 static inline int fcpcmd_is_corrupted(struct atio *atio)
375375 {
376376 if (atio->entry_type == ATIO_TYPE7 &&
377− (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) <
378− FCP_CMD_LENGTH_MIN))
377+ ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
378+ FCP_CMD_LENGTH_MIN))
379379 return 1;
380380 else
381381 return 0;
drivers/scsi/sd.c+5−1
@@ -1277,7 +1277,8 @@ static int sd_init_command(struct scsi_cmnd *cmd) · 1276 unmodified lines
12771277 case REQ_OP_ZONE_RESET:
12781278 return sd_zbc_setup_reset_cmnd(cmd);
12791279 default:
1280− BUG();
1280+ WARN_ON_ONCE(1);
1281+ return BLKPREP_KILL;
12811282 }
12821283 }
12831284
@@ -2960,6 +2961,9 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp) · 1676 unmodified lines
29602961 if (rot == 1) {
29612962 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
29622963 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
2964+ } else {
2965+ blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
2966+ blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
29632967 }
29642968
29652969 if (sdkp->device->type == TYPE_ZBC) {
drivers/scsi/ufs/ufshcd.c+7−0
@@ -7940,6 +7940,13 @@ int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle) · 7939 unmodified lines
79407940 err = -ENOMEM;
79417941 goto out_error;
79427942 }
7943+
7944+ /*
7945+ * Do not use blk-mq at this time because blk-mq does not support
7946+ * runtime pm.
7947+ */
7948+ host->use_blk_mq = false;
7949+
79437950 hba = shost_priv(host);
79447951 hba->host = host;
79457952 hba->dev = dev;
drivers/soundwire/stream.c+17−6
@@ -899,9 +899,10 @@ static void sdw_release_master_stream(struct sdw_stream_runtime *stream) · 898 unmodified lines
899899 struct sdw_master_runtime *m_rt = stream->m_rt;
900900 struct sdw_slave_runtime *s_rt, *_s_rt;
901901
902− list_for_each_entry_safe(s_rt, _s_rt,
903− &m_rt->slave_rt_list, m_rt_node)
904− sdw_stream_remove_slave(s_rt->slave, stream);
902+ list_for_each_entry_safe(s_rt, _s_rt, &m_rt->slave_rt_list, m_rt_node) {
903+ sdw_slave_port_release(s_rt->slave->bus, s_rt->slave, stream);
904+ sdw_release_slave_stream(s_rt->slave, stream);
905+ }
905906
906907 list_del(&m_rt->bus_node);
907908 }
@@ -1112,7 +1113,7 @@ int sdw_stream_add_master(struct sdw_bus *bus, · 204 unmodified lines
11121113 "Master runtime config failed for stream:%s",
11131114 stream->name);
11141115 ret = -ENOMEM;
1115− goto error;
1116+ goto unlock;
11161117 }
11171118
11181119 ret = sdw_config_stream(bus->dev, stream, stream_config, false);
@@ -1123,11 +1124,11 @@ int sdw_stream_add_master(struct sdw_bus *bus, · 4 unmodified lines
11231124 if (ret)
11241125 goto stream_error;
11251126
1126− stream->state = SDW_STREAM_CONFIGURED;
1127+ goto unlock;
11271128
11281129 stream_error:
11291130 sdw_release_master_stream(stream);
1130−error:
1131+unlock:
11311132 mutex_unlock(&bus->bus_lock);
11321133 return ret;
11331134 }
@@ -1141,6 +1142,10 @@ EXPORT_SYMBOL(sdw_stream_add_master); · 7 unmodified lines
11411142 * @stream: SoundWire stream
11421143 * @port_config: Port configuration for audio stream
11431144 * @num_ports: Number of ports
1145+ *
1146+ * It is expected that Slave is added before adding Master
1147+ * to the Stream.
1148+ *
11441149 */
11451150 int sdw_stream_add_slave(struct sdw_slave *slave,
11461151 struct sdw_stream_config *stream_config,
@@ -1186,6 +1191,12 @@ int sdw_stream_add_slave(struct sdw_slave *slave, · 39 unmodified lines
11861191 if (ret)
11871192 goto stream_error;
11881193
1194+ /*
1195+ * Change stream state to CONFIGURED on first Slave add.
1196+ * Bus is not aware of number of Slave(s) in a stream at this
1197+ * point so cannot depend on all Slave(s) to be added in order to
1198+ * change stream state to CONFIGURED.
1199+ */
11891200 stream->state = SDW_STREAM_CONFIGURED;
11901201 goto error;
11911202
drivers/spi/spi-fsl-dspi.c+6−0
@@ -30,7 +30,11 @@ · 29 unmodified lines
3030
3131 #define DRIVER_NAME "fsl-dspi"
3232
33+#ifdef CONFIG_M5441x
34+#define DSPI_FIFO_SIZE 16
35+#else
3336 #define DSPI_FIFO_SIZE 4
37+#endif
3438 #define DSPI_DMA_BUFSIZE (DSPI_FIFO_SIZE * 1024)
3539
3640 #define SPI_MCR 0x00
@@ -623,9 +627,11 @@ static void dspi_tcfq_read(struct fsl_dspi *dspi) · 586 unmodified lines
623627 static void dspi_eoq_write(struct fsl_dspi *dspi)
624628 {
625629 int fifo_size = DSPI_FIFO_SIZE;
630+ u16 xfer_cmd = dspi->tx_cmd;
626631
627632 /* Fill TX FIFO with as many transfers as possible */
628633 while (dspi->len && fifo_size--) {
634+ dspi->tx_cmd = xfer_cmd;
629635 /* Request EOQF for last transfer in FIFO */
630636 if (dspi->len == dspi->bytes_per_word || fifo_size == 0)
631637 dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ;
drivers/spi/spi-gpio.c+2−2
@@ -300,8 +300,8 @@ static int spi_gpio_request(struct device *dev, · 299 unmodified lines
300300 *mflags |= SPI_MASTER_NO_RX;
301301
302302 spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
303− if (IS_ERR(spi_gpio->mosi))
304− return PTR_ERR(spi_gpio->mosi);
303+ if (IS_ERR(spi_gpio->sck))
304+ return PTR_ERR(spi_gpio->sck);
305305
306306 for (i = 0; i < num_chipselects; i++) {
307307 spi_gpio->cs_gpios[i] = devm_gpiod_get_index(dev, "cs",
drivers/spi/spi-rspi.c+30−4
@@ -598,11 +598,13 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, · 597 unmodified lines
598598
599599 ret = wait_event_interruptible_timeout(rspi->wait,
600600 rspi->dma_callbacked, HZ);
601− if (ret > 0 && rspi->dma_callbacked)
601+ if (ret > 0 && rspi->dma_callbacked) {
602602 ret = 0;
603− else if (!ret) {
604− dev_err(&rspi->master->dev, "DMA timeout\n");
605− ret = -ETIMEDOUT;
603+ } else {
604+ if (!ret) {
605+ dev_err(&rspi->master->dev, "DMA timeout\n");
606+ ret = -ETIMEDOUT;
607+ }
606608 if (tx)
607609 dmaengine_terminate_all(rspi->master->dma_tx);
608610 if (rx)
@@ -1350,12 +1352,36 @@ static const struct platform_device_id spi_driver_ids[] = { · 741 unmodified lines
13501352
13511353 MODULE_DEVICE_TABLE(platform, spi_driver_ids);
13521354
1355+#ifdef CONFIG_PM_SLEEP
1356+static int rspi_suspend(struct device *dev)
1357+{
1358+ struct platform_device *pdev = to_platform_device(dev);
1359+ struct rspi_data *rspi = platform_get_drvdata(pdev);
1360+
1361+ return spi_master_suspend(rspi->master);
1362+}
1363+
1364+static int rspi_resume(struct device *dev)
1365+{
1366+ struct platform_device *pdev = to_platform_device(dev);
1367+ struct rspi_data *rspi = platform_get_drvdata(pdev);
1368+
1369+ return spi_master_resume(rspi->master);
1370+}
1371+
1372+static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume);
1373+#define DEV_PM_OPS &rspi_pm_ops
1374+#else
1375+#define DEV_PM_OPS NULL
1376+#endif /* CONFIG_PM_SLEEP */
1377+
13531378 static struct platform_driver rspi_driver = {
13541379 .probe = rspi_probe,
13551380 .remove = rspi_remove,
13561381 .id_table = spi_driver_ids,
13571382 .driver = {
13581383 .name = "renesas_spi",
1384+ .pm = DEV_PM_OPS,
13591385 .of_match_table = of_match_ptr(rspi_of_match),
13601386 },
13611387 };
drivers/spi/spi-sh-msiof.c+27−1
@@ -397,7 +397,8 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p, · 396 unmodified lines
397397
398398 static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p)
399399 {
400− sh_msiof_write(p, STR, sh_msiof_read(p, STR));
400+ sh_msiof_write(p, STR,
401+ sh_msiof_read(p, STR) & ~(STR_TDREQ | STR_RDREQ));
401402 }
402403
403404 static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p,
@@ -1426,12 +1427,37 @@ static const struct platform_device_id spi_driver_ids[] = { · 1022 unmodified lines
14261427 };
14271428 MODULE_DEVICE_TABLE(platform, spi_driver_ids);
14281429
1430+#ifdef CONFIG_PM_SLEEP
1431+static int sh_msiof_spi_suspend(struct device *dev)
1432+{
1433+ struct platform_device *pdev = to_platform_device(dev);
1434+ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
1435+
1436+ return spi_master_suspend(p->master);
1437+}
1438+
1439+static int sh_msiof_spi_resume(struct device *dev)
1440+{
1441+ struct platform_device *pdev = to_platform_device(dev);
1442+ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
1443+
1444+ return spi_master_resume(p->master);
1445+}
1446+
1447+static SIMPLE_DEV_PM_OPS(sh_msiof_spi_pm_ops, sh_msiof_spi_suspend,
1448+ sh_msiof_spi_resume);
1449+#define DEV_PM_OPS &sh_msiof_spi_pm_ops
1450+#else
1451+#define DEV_PM_OPS NULL
1452+#endif /* CONFIG_PM_SLEEP */
1453+
14291454 static struct platform_driver sh_msiof_spi_drv = {
14301455 .probe = sh_msiof_spi_probe,
14311456 .remove = sh_msiof_spi_remove,
14321457 .id_table = spi_driver_ids,
14331458 .driver = {
14341459 .name = "spi_sh_msiof",
1460+ .pm = DEV_PM_OPS,
14351461 .of_match_table = of_match_ptr(sh_msiof_match),
14361462 },
14371463 };
drivers/spi/spi-tegra20-slink.c+23−8
@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct platform_device *pdev) · 1062 unmodified lines
10631063 goto exit_free_master;
10641064 }
10651065
1066+ /* disabled clock may cause interrupt storm upon request */
1067+ tspi->clk = devm_clk_get(&pdev->dev, NULL);
1068+ if (IS_ERR(tspi->clk)) {
1069+ ret = PTR_ERR(tspi->clk);
1070+ dev_err(&pdev->dev, "Can not get clock %d\n", ret);
1071+ goto exit_free_master;
1072+ }
1073+ ret = clk_prepare(tspi->clk);
1074+ if (ret < 0) {
1075+ dev_err(&pdev->dev, "Clock prepare failed %d\n", ret);
1076+ goto exit_free_master;
1077+ }
1078+ ret = clk_enable(tspi->clk);
1079+ if (ret < 0) {
1080+ dev_err(&pdev->dev, "Clock enable failed %d\n", ret);
1081+ goto exit_free_master;
1082+ }
1083+
10661084 spi_irq = platform_get_irq(pdev, 0);
10671085 tspi->irq = spi_irq;
10681086 ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct platform_device *pdev) · 2 unmodified lines
10711089 if (ret < 0) {
10721090 dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
10731091 tspi->irq);
1074− goto exit_free_master;
1075− }
1076−
1077− tspi->clk = devm_clk_get(&pdev->dev, NULL);
1078− if (IS_ERR(tspi->clk)) {
1079− dev_err(&pdev->dev, "can not get clock\n");
1080− ret = PTR_ERR(tspi->clk);
1081− goto exit_free_irq;
1092+ goto exit_clk_disable;
10821093 }
10831094
10841095 tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi");
@@ -1138,6 +1149,8 @@ exit_rx_dma_free: · 53 unmodified lines
11381149 tegra_slink_deinit_dma_param(tspi, true);
11391150 exit_free_irq:
11401151 free_irq(spi_irq, tspi);
1152+exit_clk_disable:
1153+ clk_disable(tspi->clk);
11411154 exit_free_master:
11421155 spi_master_put(master);
11431156 return ret;
@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct platform_device *pdev) · 6 unmodified lines
11501163
11511164 free_irq(tspi->irq, tspi);
11521165
1166+ clk_disable(tspi->clk);
1167+
11531168 if (tspi->tx_dma_chan)
11541169 tegra_slink_deinit_dma_param(tspi, false);
11551170
drivers/spi/spi.c+11−2
@@ -2143,8 +2143,17 @@ int spi_register_controller(struct spi_controller *ctlr) · 2142 unmodified lines
21432143 */
21442144 if (ctlr->num_chipselect == 0)
21452145 return -EINVAL;
2146− /* allocate dynamic bus number using Linux idr */
2147− if ((ctlr->bus_num < 0) && ctlr->dev.of_node) {
2146+ if (ctlr->bus_num >= 0) {
2147+ /* devices with a fixed bus num must check-in with the num */
2148+ mutex_lock(&board_lock);
2149+ id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num,
2150+ ctlr->bus_num + 1, GFP_KERNEL);
2151+ mutex_unlock(&board_lock);
2152+ if (WARN(id < 0, "couldn't get idr"))
2153+ return id == -ENOSPC ? -EBUSY : id;
2154+ ctlr->bus_num = id;
2155+ } else if (ctlr->dev.of_node) {
2156+ /* allocate dynamic bus number using Linux idr */
21482157 id = of_alias_get_id(ctlr->dev.of_node, "spi");
21492158 if (id >= 0) {
21502159 ctlr->bus_num = id;
drivers/staging/erofs/Kconfig+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 config EROFS_FS
44 tristate "EROFS filesystem support"
5− depends on BROKEN
5+ depends on BLOCK
66 help
77 EROFS(Enhanced Read-Only File System) is a lightweight
88 read-only file system with modern designs (eg. page-sized
drivers/staging/erofs/super.c+2−2
@@ -340,7 +340,7 @@ static int erofs_read_super(struct super_block *sb, · 339 unmodified lines
340340 goto err_sbread;
341341
342342 sb->s_magic = EROFS_SUPER_MAGIC;
343− sb->s_flags |= MS_RDONLY | MS_NOATIME;
343+ sb->s_flags |= SB_RDONLY | SB_NOATIME;
344344 sb->s_maxbytes = MAX_LFS_FILESIZE;
345345 sb->s_time_gran = 1;
346346
@@ -627,7 +627,7 @@ static int erofs_remount(struct super_block *sb, int *flags, char *data) · 280 unmodified lines
627627 {
628628 BUG_ON(!sb_rdonly(sb));
629629
630− *flags |= MS_RDONLY;
630+ *flags |= SB_RDONLY;
631631 return 0;
632632 }
633633
drivers/staging/fbtft/TODO+4−0
@@ -2,3 +2,7 @@ · 1 unmodified line
22 GPIO descriptor API in <linux/gpio/consumer.h> and look up GPIO
33 lines from device tree, ACPI or board files, board files should
44 use <linux/gpio/machine.h>
5+
6+* convert all these over to drm_simple_display_pipe and submit for inclusion
7+ into the DRM subsystem under drivers/gpu/drm - fbdev doesn't take any new
8+ drivers anymore.
drivers/staging/gasket/TODO+13−0
@@ -1,9 +1,22 @@
11 This is a list of things that need to be done to get this driver out of the
22 staging directory.
3+
4+- Implement the gasket framework's functionality through UIO instead of
5+ introducing a new user-space drivers framework that is quite similar.
6+
7+ UIO provides the necessary bits to implement user-space drivers. Meanwhile
8+ the gasket APIs adds some extra conveniences like PCI BAR mapping, and
9+ MSI interrupts. Add these features to the UIO subsystem, then re-implement
10+ the Apex driver as a basic UIO driver instead (include/linux/uio_driver.h)
11+
312 - Document sysfs files with Documentation/ABI/ entries.
13+
414 - Use misc interface instead of major number for driver version description.
15+
516 - Add descriptions of module_param's
17+
618 - apex_get_status() should actually check status.
19+
720 - "drivers" should never be dealing with "raw" sysfs calls or mess around with
821 kobjects at all. The driver core should handle all of this for you
922 automaically. There should not be a need for raw attribute macros.
drivers/staging/media/mt9t031/Kconfig+0−6
@@ -1,9 +1,3 @@
1−config SOC_CAMERA_IMX074
2− tristate "imx074 support (DEPRECATED)"
3− depends on SOC_CAMERA && I2C
4− help
5− This driver supports IMX074 cameras from Sony
6−
71 config SOC_CAMERA_MT9T031
82 tristate "mt9t031 support (DEPRECATED)"
93 depends on SOC_CAMERA && I2C
drivers/staging/vboxvideo/vbox_drv.c+7−0
@@ -59,6 +59,11 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 58 unmodified lines
5959 ret = PTR_ERR(dev);
6060 goto err_drv_alloc;
6161 }
62+
63+ ret = pci_enable_device(pdev);
64+ if (ret)
65+ goto err_pci_enable;
66+
6267 dev->pdev = pdev;
6368 pci_set_drvdata(pdev, dev);
6469
@@ -75,6 +80,8 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 10 unmodified lines
7580 err_drv_dev_register:
7681 vbox_driver_unload(dev);
7782 err_vbox_driver_load:
83+ pci_disable_device(pdev);
84+ err_pci_enable:
7885 drm_dev_put(dev);
7986 err_drv_alloc:
8087 return ret;
drivers/staging/vboxvideo/vbox_mode.c+5−0
@@ -323,6 +323,11 @@ static int vbox_crtc_page_flip(struct drm_crtc *crtc, · 322 unmodified lines
323323 if (rc)
324324 return rc;
325325
326+ mutex_lock(&vbox->hw_mutex);
327+ vbox_set_view(crtc);
328+ vbox_do_modeset(crtc, &crtc->mode);
329+ mutex_unlock(&vbox->hw_mutex);
330+
326331 spin_lock_irqsave(&drm->event_lock, flags);
327332
328333 if (event)
drivers/staging/wilc1000/Makefile+1−2
@@ -1,4 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0
2+obj-$(CONFIG_WILC1000) += wilc1000.o
23
34 ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
45 -DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
@@ -11,9 +12,7 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ · 6 unmodified lines
1112 wilc_wlan.o
1213
1314 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
14−wilc1000-sdio-objs += $(wilc1000-objs)
1515 wilc1000-sdio-objs += wilc_sdio.o
1616
1717 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
18−wilc1000-spi-objs += $(wilc1000-objs)
1918 wilc1000-spi-objs += wilc_spi.o
drivers/staging/wilc1000/linux_wlan.c+4−2
@@ -1038,8 +1038,8 @@ void wilc_netdev_cleanup(struct wilc *wilc) · 1037 unmodified lines
10381038 }
10391039
10401040 kfree(wilc);
1041− wilc_debugfs_remove();
10421041 }
1042+EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
10431043
10441044 static const struct net_device_ops wilc_netdev_ops = {
10451045 .ndo_init = mac_init_fn,
@@ -1062,7 +1062,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, · 16 unmodified lines
10621062 if (!wl)
10631063 return -ENOMEM;
10641064
1065− wilc_debugfs_init();
10661065 *wilc = wl;
10671066 wl->io_type = io_type;
10681067 wl->hif_func = ops;
@@ -1124,3 +1123,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, · 55 unmodified lines
11241123
11251124 return 0;
11261125 }
1126+EXPORT_SYMBOL_GPL(wilc_netdev_init);
1127+
1128+MODULE_LICENSE("GPL");
drivers/staging/wilc1000/wilc_debugfs.c+5−2
@@ -19,6 +19,7 @@ static struct dentry *wilc_dir; · 18 unmodified lines
1919
2020 #define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
2121 static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
22+EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
2223
2324 static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
2425 size_t count, loff_t *ppos)
@@ -87,7 +88,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = { · 62 unmodified lines
8788 },
8889 };
8990
90−int wilc_debugfs_init(void)
91+static int __init wilc_debugfs_init(void)
9192 {
9293 int i;
9394 struct wilc_debugfs_info_t *info;
@@ -103,10 +104,12 @@ int wilc_debugfs_init(void) · 9 unmodified lines
103104 }
104105 return 0;
105106 }
107+module_init(wilc_debugfs_init);
106108
107−void wilc_debugfs_remove(void)
109+static void __exit wilc_debugfs_remove(void)
108110 {
109111 debugfs_remove_recursive(wilc_dir);
110112 }
113+module_exit(wilc_debugfs_remove);
111114
112115 #endif
drivers/staging/wilc1000/wilc_wlan.c+6−0
@@ -417,6 +417,7 @@ void chip_allow_sleep(struct wilc *wilc) · 416 unmodified lines
417417 wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
418418 wilc->hif_func->hif_write_reg(wilc, 0xfa, 0);
419419 }
420+EXPORT_SYMBOL_GPL(chip_allow_sleep);
420421
421422 void chip_wakeup(struct wilc *wilc)
422423 {
@@ -471,6 +472,7 @@ void chip_wakeup(struct wilc *wilc) · 48 unmodified lines
471472 }
472473 chip_ps_state = CHIP_WAKEDUP;
473474 }
475+EXPORT_SYMBOL_GPL(chip_wakeup);
474476
475477 void wilc_chip_sleep_manually(struct wilc *wilc)
476478 {
@@ -484,6 +486,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc) · 7 unmodified lines
484486 chip_ps_state = CHIP_SLEEPING_MANUAL;
485487 release_bus(wilc, RELEASE_ONLY);
486488 }
489+EXPORT_SYMBOL_GPL(wilc_chip_sleep_manually);
487490
488491 void host_wakeup_notify(struct wilc *wilc)
489492 {
@@ -491,6 +494,7 @@ void host_wakeup_notify(struct wilc *wilc) · 1 unmodified line
491494 wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
492495 release_bus(wilc, RELEASE_ONLY);
493496 }
497+EXPORT_SYMBOL_GPL(host_wakeup_notify);
494498
495499 void host_sleep_notify(struct wilc *wilc)
496500 {
@@ -498,6 +502,7 @@ void host_sleep_notify(struct wilc *wilc) · 1 unmodified line
498502 wilc->hif_func->hif_write_reg(wilc, 0x10ac, 1);
499503 release_bus(wilc, RELEASE_ONLY);
500504 }
505+EXPORT_SYMBOL_GPL(host_sleep_notify);
501506
502507 int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
503508 {
@@ -871,6 +876,7 @@ void wilc_handle_isr(struct wilc *wilc) · 367 unmodified lines
871876
872877 release_bus(wilc, RELEASE_ALLOW_SLEEP);
873878 }
879+EXPORT_SYMBOL_GPL(wilc_handle_isr);
874880
875881 int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
876882 u32 buffer_size)
drivers/staging/wilc1000/wilc_wlan_if.h+0−2
@@ -831,6 +831,4 @@ struct wilc; · 830 unmodified lines
831831 int wilc_wlan_init(struct net_device *dev);
832832 u32 wilc_get_chipid(struct wilc *wilc, bool update);
833833
834−int wilc_debugfs_init(void);
835−void wilc_debugfs_remove(void);
836834 #endif
drivers/target/iscsi/iscsi_target.c+15−16
@@ -1416,7 +1416,8 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash, · 1415 unmodified lines
14161416
14171417 sg_init_table(sg, ARRAY_SIZE(sg));
14181418 sg_set_buf(sg, buf, payload_length);
1419− sg_set_buf(sg + 1, pad_bytes, padding);
1419+ if (padding)
1420+ sg_set_buf(sg + 1, pad_bytes, padding);
14201421
14211422 ahash_request_set_crypt(hash, sg, data_crc, payload_length + padding);
14221423
@@ -3910,10 +3911,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) · 2487 unmodified lines
39103911 static void iscsit_get_rx_pdu(struct iscsi_conn *conn)
39113912 {
39123913 int ret;
3913− u8 buffer[ISCSI_HDR_LEN], opcode;
3914+ u8 *buffer, opcode;
39143915 u32 checksum = 0, digest = 0;
39153916 struct kvec iov;
39163917
3918+ buffer = kcalloc(ISCSI_HDR_LEN, sizeof(*buffer), GFP_KERNEL);
3919+ if (!buffer)
3920+ return;
3921+
39173922 while (!kthread_should_stop()) {
39183923 /*
39193924 * Ensure that both TX and RX per connection kthreads
@@ -3921,7 +3926,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) · 1 unmodified line
39213926 */
39223927 iscsit_thread_check_cpumask(conn, current, 0);
39233928
3924− memset(buffer, 0, ISCSI_HDR_LEN);
39253929 memset(&iov, 0, sizeof(struct kvec));
39263930
39273931 iov.iov_base = buffer;
@@ -3930,7 +3934,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) · 2 unmodified lines
39303934 ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN);
39313935 if (ret != ISCSI_HDR_LEN) {
39323936 iscsit_rx_thread_wait_for_tcp(conn);
3933− return;
3937+ break;
39343938 }
39353939
39363940 if (conn->conn_ops->HeaderDigest) {
@@ -3940,7 +3944,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) · 3 unmodified lines
39403944 ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN);
39413945 if (ret != ISCSI_CRC_LEN) {
39423946 iscsit_rx_thread_wait_for_tcp(conn);
3943− return;
3947+ break;
39443948 }
39453949
39463950 iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer,
@@ -3964,7 +3968,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) · 17 unmodified lines
39643968 }
39653969
39663970 if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT)
3967− return;
3971+ break;
39683972
39693973 opcode = buffer[0] & ISCSI_OPCODE_MASK;
39703974
@@ -3975,13 +3979,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) · 4 unmodified lines
39753979 " while in Discovery Session, rejecting.\n", opcode);
39763980 iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
39773981 buffer);
3978− return;
3982+ break;
39793983 }
39803984
39813985 ret = iscsi_target_rx_opcode(conn, buffer);
39823986 if (ret < 0)
3983− return;
3987+ break;
39843988 }
3989+
3990+ kfree(buffer);
39853991 }
39863992
39873993 int iscsi_target_rx_thread(void *arg)
@@ -4208,22 +4214,15 @@ int iscsit_close_connection( · 220 unmodified lines
42084214 crypto_free_ahash(tfm);
42094215 }
42104216
4211− free_cpumask_var(conn->conn_cpumask);
4212−
4213− kfree(conn->conn_ops);
4214− conn->conn_ops = NULL;
4215−
42164217 if (conn->sock)
42174218 sock_release(conn->sock);
42184219
42194220 if (conn->conn_transport->iscsit_free_conn)
42204221 conn->conn_transport->iscsit_free_conn(conn);
42214222
4222− iscsit_put_transport(conn->conn_transport);
4223−
42244223 pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
42254224 conn->conn_state = TARG_CONN_STATE_FREE;
4226− kfree(conn);
4225+ iscsit_free_conn(conn);
42274226
42284227 spin_lock_bh(&sess->conn_lock);
42294228 atomic_dec(&sess->nconn);
drivers/target/iscsi/iscsi_target_auth.c+17−28
@@ -26,27 +26,6 @@ · 25 unmodified lines
2626 #include "iscsi_target_nego.h"
2727 #include "iscsi_target_auth.h"
2828
29−static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len)
30−{
31− int j = DIV_ROUND_UP(len, 2), rc;
32−
33− rc = hex2bin(dst, src, j);
34− if (rc < 0)
35− pr_debug("CHAP string contains non hex digit symbols\n");
36−
37− dst[j] = '\0';
38− return j;
39−}
40−
41−static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len)
42−{
43− int i;
44−
45− for (i = 0; i < src_len; i++) {
46− sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff);
47− }
48−}
49−
5029 static int chap_gen_challenge(
5130 struct iscsi_conn *conn,
5231 int caller,
@@ -62,7 +41,7 @@ static int chap_gen_challenge( · 9 unmodified lines
6241 ret = get_random_bytes_wait(chap->challenge, CHAP_CHALLENGE_LENGTH);
6342 if (unlikely(ret))
6443 return ret;
65− chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge,
44+ bin2hex(challenge_asciihex, chap->challenge,
6645 CHAP_CHALLENGE_LENGTH);
6746 /*
6847 * Set CHAP_C, and copy the generated challenge into c_str.
@@ -248,9 +227,16 @@ static int chap_server_compute_md5( · 179 unmodified lines
248227 pr_err("Could not find CHAP_R.\n");
249228 goto out;
250229 }
230+ if (strlen(chap_r) != MD5_SIGNATURE_SIZE * 2) {
231+ pr_err("Malformed CHAP_R\n");
232+ goto out;
233+ }
234+ if (hex2bin(client_digest, chap_r, MD5_SIGNATURE_SIZE) < 0) {
235+ pr_err("Malformed CHAP_R\n");
236+ goto out;
237+ }
251238
252239 pr_debug("[server] Got CHAP_R=%s\n", chap_r);
253− chap_string_to_hex(client_digest, chap_r, strlen(chap_r));
254240
255241 tfm = crypto_alloc_shash("md5", 0, 0);
256242 if (IS_ERR(tfm)) {
@@ -294,7 +280,7 @@ static int chap_server_compute_md5( · 37 unmodified lines
294280 goto out;
295281 }
296282
297− chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE);
283+ bin2hex(response, server_digest, MD5_SIGNATURE_SIZE);
298284 pr_debug("[server] MD5 Server Digest: %s\n", response);
299285
300286 if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) {
@@ -349,9 +335,7 @@ static int chap_server_compute_md5( · 48 unmodified lines
349335 pr_err("Could not find CHAP_C.\n");
350336 goto out;
351337 }
352− pr_debug("[server] Got CHAP_C=%s\n", challenge);
353− challenge_len = chap_string_to_hex(challenge_binhex, challenge,
354− strlen(challenge));
338+ challenge_len = DIV_ROUND_UP(strlen(challenge), 2);
355339 if (!challenge_len) {
356340 pr_err("Unable to convert incoming challenge\n");
357341 goto out;
@@ -360,6 +344,11 @@ static int chap_server_compute_md5( · 2 unmodified lines
360344 pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n");
361345 goto out;
362346 }
347+ if (hex2bin(challenge_binhex, challenge, challenge_len) < 0) {
348+ pr_err("Malformed CHAP_C\n");
349+ goto out;
350+ }
351+ pr_debug("[server] Got CHAP_C=%s\n", challenge);
363352 /*
364353 * During mutual authentication, the CHAP_C generated by the
365354 * initiator must not match the original CHAP_C generated by
@@ -413,7 +402,7 @@ static int chap_server_compute_md5( · 47 unmodified lines
413402 /*
414403 * Convert response from binary hex to ascii hext.
415404 */
416− chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE);
405+ bin2hex(response, digest, MD5_SIGNATURE_SIZE);
417406 *nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s",
418407 response);
419408 *nr_out_len += 1;
drivers/target/iscsi/iscsi_target_login.c+78−71
@@ -67,45 +67,10 @@ static struct iscsi_login *iscsi_login_init_conn(struct iscsi_conn *conn) · 66 unmodified lines
6767 goto out_req_buf;
6868 }
6969
70− conn->conn_ops = kzalloc(sizeof(struct iscsi_conn_ops), GFP_KERNEL);
71− if (!conn->conn_ops) {
72− pr_err("Unable to allocate memory for"
73− " struct iscsi_conn_ops.\n");
74− goto out_rsp_buf;
75− }
76−
77− init_waitqueue_head(&conn->queues_wq);
78− INIT_LIST_HEAD(&conn->conn_list);
79− INIT_LIST_HEAD(&conn->conn_cmd_list);
80− INIT_LIST_HEAD(&conn->immed_queue_list);
81− INIT_LIST_HEAD(&conn->response_queue_list);
82− init_completion(&conn->conn_post_wait_comp);
83− init_completion(&conn->conn_wait_comp);
84− init_completion(&conn->conn_wait_rcfr_comp);
85− init_completion(&conn->conn_waiting_on_uc_comp);
86− init_completion(&conn->conn_logout_comp);
87− init_completion(&conn->rx_half_close_comp);
88− init_completion(&conn->tx_half_close_comp);
89− init_completion(&conn->rx_login_comp);
90− spin_lock_init(&conn->cmd_lock);
91− spin_lock_init(&conn->conn_usage_lock);
92− spin_lock_init(&conn->immed_queue_lock);
93− spin_lock_init(&conn->nopin_timer_lock);
94− spin_lock_init(&conn->response_queue_lock);
95− spin_lock_init(&conn->state_lock);
96−
97− if (!zalloc_cpumask_var(&conn->conn_cpumask, GFP_KERNEL)) {
98− pr_err("Unable to allocate conn->conn_cpumask\n");
99− goto out_conn_ops;
100− }
10170 conn->conn_login = login;
10271
10372 return login;
10473
105−out_conn_ops:
106− kfree(conn->conn_ops);
107−out_rsp_buf:
108− kfree(login->rsp_buf);
10974 out_req_buf:
11075 kfree(login->req_buf);
11176 out_login:
@@ -310,11 +275,9 @@ static int iscsi_login_zero_tsih_s1( · 198 unmodified lines
310275 return -ENOMEM;
311276 }
312277
313− ret = iscsi_login_set_conn_values(sess, conn, pdu->cid);
314− if (unlikely(ret)) {
315− kfree(sess);
316− return ret;
317− }
278+ if (iscsi_login_set_conn_values(sess, conn, pdu->cid))
279+ goto free_sess;
280+
318281 sess->init_task_tag = pdu->itt;
319282 memcpy(&sess->isid, pdu->isid, 6);
320283 sess->exp_cmd_sn = be32_to_cpu(pdu->cmdsn);
@@ -1149,6 +1112,75 @@ iscsit_conn_set_transport(struct iscsi_conn *conn, struct iscsit_transport *t) · 828 unmodified lines
11491112 return 0;
11501113 }
11511114
1115+static struct iscsi_conn *iscsit_alloc_conn(struct iscsi_np *np)
1116+{
1117+ struct iscsi_conn *conn;
1118+
1119+ conn = kzalloc(sizeof(struct iscsi_conn), GFP_KERNEL);
1120+ if (!conn) {
1121+ pr_err("Could not allocate memory for new connection\n");
1122+ return NULL;
1123+ }
1124+ pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
1125+ conn->conn_state = TARG_CONN_STATE_FREE;
1126+
1127+ init_waitqueue_head(&conn->queues_wq);
1128+ INIT_LIST_HEAD(&conn->conn_list);
1129+ INIT_LIST_HEAD(&conn->conn_cmd_list);
1130+ INIT_LIST_HEAD(&conn->immed_queue_list);
1131+ INIT_LIST_HEAD(&conn->response_queue_list);
1132+ init_completion(&conn->conn_post_wait_comp);
1133+ init_completion(&conn->conn_wait_comp);
1134+ init_completion(&conn->conn_wait_rcfr_comp);
1135+ init_completion(&conn->conn_waiting_on_uc_comp);
1136+ init_completion(&conn->conn_logout_comp);
1137+ init_completion(&conn->rx_half_close_comp);
1138+ init_completion(&conn->tx_half_close_comp);
1139+ init_completion(&conn->rx_login_comp);
1140+ spin_lock_init(&conn->cmd_lock);
1141+ spin_lock_init(&conn->conn_usage_lock);
1142+ spin_lock_init(&conn->immed_queue_lock);
1143+ spin_lock_init(&conn->nopin_timer_lock);
1144+ spin_lock_init(&conn->response_queue_lock);
1145+ spin_lock_init(&conn->state_lock);
1146+
1147+ timer_setup(&conn->nopin_response_timer,
1148+ iscsit_handle_nopin_response_timeout, 0);
1149+ timer_setup(&conn->nopin_timer, iscsit_handle_nopin_timeout, 0);
1150+
1151+ if (iscsit_conn_set_transport(conn, np->np_transport) < 0)
1152+ goto free_conn;
1153+
1154+ conn->conn_ops = kzalloc(sizeof(struct iscsi_conn_ops), GFP_KERNEL);
1155+ if (!conn->conn_ops) {
1156+ pr_err("Unable to allocate memory for struct iscsi_conn_ops.\n");
1157+ goto put_transport;
1158+ }
1159+
1160+ if (!zalloc_cpumask_var(&conn->conn_cpumask, GFP_KERNEL)) {
1161+ pr_err("Unable to allocate conn->conn_cpumask\n");
1162+ goto free_mask;
1163+ }
1164+
1165+ return conn;
1166+
1167+free_mask:
1168+ free_cpumask_var(conn->conn_cpumask);
1169+put_transport:
1170+ iscsit_put_transport(conn->conn_transport);
1171+free_conn:
1172+ kfree(conn);
1173+ return NULL;
1174+}
1175+
1176+void iscsit_free_conn(struct iscsi_conn *conn)
1177+{
1178+ free_cpumask_var(conn->conn_cpumask);
1179+ kfree(conn->conn_ops);
1180+ iscsit_put_transport(conn->conn_transport);
1181+ kfree(conn);
1182+}
1183+
11521184 void iscsi_target_login_sess_out(struct iscsi_conn *conn,
11531185 struct iscsi_np *np, bool zero_tsih, bool new_sess)
11541186 {
@@ -1198,10 +1230,6 @@ old_sess_out: · 43 unmodified lines
11981230 crypto_free_ahash(tfm);
11991231 }
12001232
1201− free_cpumask_var(conn->conn_cpumask);
1202−
1203− kfree(conn->conn_ops);
1204−
12051233 if (conn->param_list) {
12061234 iscsi_release_param_list(conn->param_list);
12071235 conn->param_list = NULL;
@@ -1219,8 +1247,7 @@ old_sess_out: · 11 unmodified lines
12191247 if (conn->conn_transport->iscsit_free_conn)
12201248 conn->conn_transport->iscsit_free_conn(conn);
12211249
1222− iscsit_put_transport(conn->conn_transport);
1223− kfree(conn);
1250+ iscsit_free_conn(conn);
12241251 }
12251252
12261253 static int __iscsi_target_login_thread(struct iscsi_np *np)
@@ -1250,31 +1277,16 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 23 unmodified lines
12501277 }
12511278 spin_unlock_bh(&np->np_thread_lock);
12521279
1253− conn = kzalloc(sizeof(struct iscsi_conn), GFP_KERNEL);
1280+ conn = iscsit_alloc_conn(np);
12541281 if (!conn) {
1255− pr_err("Could not allocate memory for"
1256− " new connection\n");
12571282 /* Get another socket */
12581283 return 1;
12591284 }
1260− pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
1261− conn->conn_state = TARG_CONN_STATE_FREE;
1262−
1263− timer_setup(&conn->nopin_response_timer,
1264− iscsit_handle_nopin_response_timeout, 0);
1265− timer_setup(&conn->nopin_timer, iscsit_handle_nopin_timeout, 0);
1266−
1267− if (iscsit_conn_set_transport(conn, np->np_transport) < 0) {
1268− kfree(conn);
1269− return 1;
1270− }
12711285
12721286 rc = np->np_transport->iscsit_accept_np(np, conn);
12731287 if (rc == -ENOSYS) {
12741288 complete(&np->np_restart_comp);
1275− iscsit_put_transport(conn->conn_transport);
1276− kfree(conn);
1277− conn = NULL;
1289+ iscsit_free_conn(conn);
12781290 goto exit;
12791291 } else if (rc < 0) {
12801292 spin_lock_bh(&np->np_thread_lock);
@@ -1282,17 +1294,13 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 1 unmodified line
12821294 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
12831295 spin_unlock_bh(&np->np_thread_lock);
12841296 complete(&np->np_restart_comp);
1285− iscsit_put_transport(conn->conn_transport);
1286− kfree(conn);
1287− conn = NULL;
1297+ iscsit_free_conn(conn);
12881298 /* Get another socket */
12891299 return 1;
12901300 }
12911301 spin_unlock_bh(&np->np_thread_lock);
1292− iscsit_put_transport(conn->conn_transport);
1293− kfree(conn);
1294− conn = NULL;
1295− goto out;
1302+ iscsit_free_conn(conn);
1303+ return 1;
12961304 }
12971305 /*
12981306 * Perform the remaining iSCSI connection initialization items..
@@ -1442,7 +1450,6 @@ old_sess_out: · 143 unmodified lines
14421450 tpg_np = NULL;
14431451 }
14441452
1445−out:
14461453 return 1;
14471454
14481455 exit:
drivers/target/iscsi/iscsi_target_login.h+1−1
@@ -19,7 +19,7 @@ extern int iscsi_target_setup_login_socket(struct iscsi_np *, · 18 unmodified lines
1919 extern int iscsit_accept_np(struct iscsi_np *, struct iscsi_conn *);
2020 extern int iscsit_get_login_rx(struct iscsi_conn *, struct iscsi_login *);
2121 extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32);
22−extern void iscsit_free_conn(struct iscsi_np *, struct iscsi_conn *);
22+extern void iscsit_free_conn(struct iscsi_conn *);
2323 extern int iscsit_start_kthreads(struct iscsi_conn *);
2424 extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8);
2525 extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *,
drivers/tty/hvc/hvc_console.c+33−5
@@ -522,6 +522,8 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count · 521 unmodified lines
522522 return -EIO;
523523
524524 while (count > 0) {
525+ int ret = 0;
526+
525527 spin_lock_irqsave(&hp->lock, flags);
526528
527529 rsize = hp->outbuf_size - hp->n_outbuf;
@@ -537,10 +539,13 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count · 9 unmodified lines
537539 }
538540
539541 if (hp->n_outbuf > 0)
540− hvc_push(hp);
542+ ret = hvc_push(hp);
541543
542544 spin_unlock_irqrestore(&hp->lock, flags);
543545
546+ if (!ret)
547+ break;
548+
544549 if (count) {
545550 if (hp->n_outbuf > 0)
546551 hvc_flush(hp);
@@ -623,6 +628,15 @@ static int hvc_chars_in_buffer(struct tty_struct *tty) · 76 unmodified lines
623628 #define MAX_TIMEOUT (2000)
624629 static u32 timeout = MIN_TIMEOUT;
625630
631+/*
632+ * Maximum number of bytes to get from the console driver if hvc_poll is
633+ * called from driver (and can't sleep). Any more than this and we break
634+ * and start polling with khvcd. This value was derived from from an OpenBMC
635+ * console with the OPAL driver that results in about 0.25ms interrupts off
636+ * latency.
637+ */
638+#define HVC_ATOMIC_READ_MAX 128
639+
626640 #define HVC_POLL_READ 0x00000001
627641 #define HVC_POLL_WRITE 0x00000002
628642
@@ -669,8 +683,8 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep) · 40 unmodified lines
669683 if (!hp->irq_requested)
670684 poll_mask |= HVC_POLL_READ;
671685
686+ read_again:
672687 /* Read data if any */
673−
674688 count = tty_buffer_request_room(&hp->port, N_INBUF);
675689
676690 /* If flip is full, just reschedule a later read */
@@ -717,9 +731,23 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep) · 40 unmodified lines
717731 #endif /* CONFIG_MAGIC_SYSRQ */
718732 tty_insert_flip_char(&hp->port, buf[i], 0);
719733 }
720− if (n == count)
721− poll_mask |= HVC_POLL_READ;
722− read_total = n;
734+ read_total += n;
735+
736+ if (may_sleep) {
737+ /* Keep going until the flip is full */
738+ spin_unlock_irqrestore(&hp->lock, flags);
739+ cond_resched();
740+ spin_lock_irqsave(&hp->lock, flags);
741+ goto read_again;
742+ } else if (read_total < HVC_ATOMIC_READ_MAX) {
743+ /* Break and defer if it's a large read in atomic */
744+ goto read_again;
745+ }
746+
747+ /*
748+ * Latency break, schedule another poll immediately.
749+ */
750+ poll_mask |= HVC_POLL_READ;
723751
724752 out:
725753 /* Wakeup write queue if necessary */
drivers/tty/serial/cpm_uart/cpm_uart_core.c+7−3
@@ -1054,8 +1054,8 @@ static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo) · 1053 unmodified lines
10541054 /* Get the address of the host memory buffer.
10551055 */
10561056 bdp = pinfo->rx_cur;
1057− while (bdp->cbd_sc & BD_SC_EMPTY)
1058− ;
1057+ if (bdp->cbd_sc & BD_SC_EMPTY)
1058+ return NO_POLL_CHAR;
10591059
10601060 /* If the buffer address is in the CPM DPRAM, don't
10611061 * convert it.
@@ -1090,7 +1090,11 @@ static int cpm_get_poll_char(struct uart_port *port) · 28 unmodified lines
10901090 poll_chars = 0;
10911091 }
10921092 if (poll_chars <= 0) {
1093− poll_chars = poll_wait_key(poll_buf, pinfo);
1093+ int ret = poll_wait_key(poll_buf, pinfo);
1094+
1095+ if (ret == NO_POLL_CHAR)
1096+ return ret;
1097+ poll_chars = ret;
10941098 pollp = poll_buf;
10951099 }
10961100 poll_chars--;
drivers/tty/serial/fsl_lpuart.c+2−1
@@ -979,7 +979,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) · 978 unmodified lines
979979 struct circ_buf *ring = &sport->rx_ring;
980980 int ret, nent;
981981 int bits, baud;
982− struct tty_struct *tty = tty_port_tty_get(&sport->port.state->port);
982+ struct tty_port *port = &sport->port.state->port;
983+ struct tty_struct *tty = port->tty;
983984 struct ktermios *termios = &tty->termios;
984985
985986 baud = tty_get_baud_rate(tty);
drivers/tty/serial/imx.c+8−0
@@ -2351,6 +2351,14 @@ static int imx_uart_probe(struct platform_device *pdev) · 2350 unmodified lines
23512351 ret);
23522352 return ret;
23532353 }
2354+
2355+ ret = devm_request_irq(&pdev->dev, rtsirq, imx_uart_rtsint, 0,
2356+ dev_name(&pdev->dev), sport);
2357+ if (ret) {
2358+ dev_err(&pdev->dev, "failed to request rts irq: %d\n",
2359+ ret);
2360+ return ret;
2361+ }
23542362 } else {
23552363 ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_int, 0,
23562364 dev_name(&pdev->dev), sport);
drivers/tty/serial/mvebu-uart.c+1−0
@@ -511,6 +511,7 @@ static void mvebu_uart_set_termios(struct uart_port *port, · 510 unmodified lines
511511 termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR);
512512 termios->c_cflag &= CREAD | CBAUD;
513513 termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD);
514+ termios->c_cflag |= CS8;
514515 }
515516
516517 spin_unlock_irqrestore(&port->lock, flags);
drivers/tty/tty_io.c+8−3
@@ -1255,6 +1255,7 @@ static void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct * · 1254 unmodified lines
12551255 static int tty_reopen(struct tty_struct *tty)
12561256 {
12571257 struct tty_driver *driver = tty->driver;
1258+ int retval;
12581259
12591260 if (driver->type == TTY_DRIVER_TYPE_PTY &&
12601261 driver->subtype == PTY_TYPE_MASTER)
@@ -1268,10 +1269,14 @@ static int tty_reopen(struct tty_struct *tty) · 7 unmodified lines
12681269
12691270 tty->count++;
12701271
1271− if (!tty->ldisc)
1272− return tty_ldisc_reinit(tty, tty->termios.c_line);
1272+ if (tty->ldisc)
1273+ return 0;
12731274
1274− return 0;
1275+ retval = tty_ldisc_reinit(tty, tty->termios.c_line);
1276+ if (retval)
1277+ tty->count--;
1278+
1279+ return retval;
12751280 }
12761281
12771282 /**
drivers/tty/vt/vt_ioctl.c+4−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #include <asm/io.h>
3333 #include <linux/uaccess.h>
3434
35+#include <linux/nospec.h>
36+
3537 #include <linux/kbd_kern.h>
3638 #include <linux/vt_kern.h>
3739 #include <linux/kbd_diacr.h>
@@ -700,6 +702,8 @@ int vt_ioctl(struct tty_struct *tty, · 662 unmodified lines
700702 if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
701703 ret = -ENXIO;
702704 else {
705+ vsa.console = array_index_nospec(vsa.console,
706+ MAX_NR_CONSOLES + 1);
703707 vsa.console--;
704708 console_lock();
705709 ret = vc_allocate(vsa.console);
drivers/usb/class/cdc-acm.c+0−73
@@ -780,20 +780,9 @@ static int acm_tty_write(struct tty_struct *tty, · 779 unmodified lines
780780 }
781781
782782 if (acm->susp_count) {
783− if (acm->putbuffer) {
784− /* now to preserve order */
785− usb_anchor_urb(acm->putbuffer->urb, &acm->delayed);
786− acm->putbuffer = NULL;
787− }
788783 usb_anchor_urb(wb->urb, &acm->delayed);
789784 spin_unlock_irqrestore(&acm->write_lock, flags);
790785 return count;
791− } else {
792− if (acm->putbuffer) {
793− /* at this point there is no good way to handle errors */
794− acm_start_wb(acm, acm->putbuffer);
795− acm->putbuffer = NULL;
796− }
797786 }
798787
799788 stat = acm_start_wb(acm, wb);
@@ -804,66 +793,6 @@ static int acm_tty_write(struct tty_struct *tty, · 4 unmodified lines
804793 return count;
805794 }
806795
807−static void acm_tty_flush_chars(struct tty_struct *tty)
808−{
809− struct acm *acm = tty->driver_data;
810− struct acm_wb *cur;
811− int err;
812− unsigned long flags;
813−
814− spin_lock_irqsave(&acm->write_lock, flags);
815−
816− cur = acm->putbuffer;
817− if (!cur) /* nothing to do */
818− goto out;
819−
820− acm->putbuffer = NULL;
821− err = usb_autopm_get_interface_async(acm->control);
822− if (err < 0) {
823− cur->use = 0;
824− acm->putbuffer = cur;
825− goto out;
826− }
827−
828− if (acm->susp_count)
829− usb_anchor_urb(cur->urb, &acm->delayed);
830− else
831− acm_start_wb(acm, cur);
832−out:
833− spin_unlock_irqrestore(&acm->write_lock, flags);
834− return;
835−}
836−
837−static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch)
838−{
839− struct acm *acm = tty->driver_data;
840− struct acm_wb *cur;
841− int wbn;
842− unsigned long flags;
843−
844−overflow:
845− cur = acm->putbuffer;
846− if (!cur) {
847− spin_lock_irqsave(&acm->write_lock, flags);
848− wbn = acm_wb_alloc(acm);
849− if (wbn >= 0) {
850− cur = &acm->wb[wbn];
851− acm->putbuffer = cur;
852− }
853− spin_unlock_irqrestore(&acm->write_lock, flags);
854− if (!cur)
855− return 0;
856− }
857−
858− if (cur->len == acm->writesize) {
859− acm_tty_flush_chars(tty);
860− goto overflow;
861− }
862−
863− cur->buf[cur->len++] = ch;
864− return 1;
865−}
866−
867796 static int acm_tty_write_room(struct tty_struct *tty)
868797 {
869798 struct acm *acm = tty->driver_data;
@@ -1987,8 +1916,6 @@ static const struct tty_operations acm_ops = { · 1117 unmodified lines
19871916 .cleanup = acm_tty_cleanup,
19881917 .hangup = acm_tty_hangup,
19891918 .write = acm_tty_write,
1990− .put_char = acm_tty_put_char,
1991− .flush_chars = acm_tty_flush_chars,
19921919 .write_room = acm_tty_write_room,
19931920 .ioctl = acm_tty_ioctl,
19941921 .throttle = acm_tty_throttle,
drivers/usb/class/cdc-acm.h+0−1
@@ -96,7 +96,6 @@ struct acm { · 95 unmodified lines
9696 unsigned long read_urbs_free;
9797 struct urb *read_urbs[ACM_NR];
9898 struct acm_rb read_buffers[ACM_NR];
99− struct acm_wb *putbuffer; /* for acm_tty_put_char() */
10099 int rx_buflimit;
101100 spinlock_t read_lock;
102101 u8 *notification_buffer; /* to reassemble fragmented notifications */
drivers/usb/common/common.c+25−0
@@ -246,6 +246,31 @@ int of_usb_update_otg_caps(struct device_node *np, · 245 unmodified lines
246246 }
247247 EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
248248
249+/**
250+ * usb_of_get_companion_dev - Find the companion device
251+ * @dev: the device pointer to find a companion
252+ *
253+ * Find the companion device from platform bus.
254+ *
255+ * Takes a reference to the returned struct device which needs to be dropped
256+ * after use.
257+ *
258+ * Return: On success, a pointer to the companion device, %NULL on failure.
259+ */
260+struct device *usb_of_get_companion_dev(struct device *dev)
261+{
262+ struct device_node *node;
263+ struct platform_device *pdev = NULL;
264+
265+ node = of_parse_phandle(dev->of_node, "companion", 0);
266+ if (node)
267+ pdev = of_find_device_by_node(node);
268+
269+ of_node_put(node);
270+
271+ return pdev ? &pdev->dev : NULL;
272+}
273+EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);
249274 #endif
250275
251276 MODULE_LICENSE("GPL");
drivers/usb/common/roles.c+12−3
@@ -109,8 +109,15 @@ static void *usb_role_switch_match(struct device_connection *con, int ep, · 108 unmodified lines
109109 */
110110 struct usb_role_switch *usb_role_switch_get(struct device *dev)
111111 {
112− return device_connection_find_match(dev, "usb-role-switch", NULL,
113− usb_role_switch_match);
112+ struct usb_role_switch *sw;
113+
114+ sw = device_connection_find_match(dev, "usb-role-switch", NULL,
115+ usb_role_switch_match);
116+
117+ if (!IS_ERR_OR_NULL(sw))
118+ WARN_ON(!try_module_get(sw->dev.parent->driver->owner));
119+
120+ return sw;
114121 }
115122 EXPORT_SYMBOL_GPL(usb_role_switch_get);
116123
@@ -122,8 +129,10 @@ EXPORT_SYMBOL_GPL(usb_role_switch_get); · 5 unmodified lines
122129 */
123130 void usb_role_switch_put(struct usb_role_switch *sw)
124131 {
125− if (!IS_ERR_OR_NULL(sw))
132+ if (!IS_ERR_OR_NULL(sw)) {
126133 put_device(&sw->dev);
134+ module_put(sw->dev.parent->driver->owner);
135+ }
127136 }
128137 EXPORT_SYMBOL_GPL(usb_role_switch_put);
129138
drivers/usb/core/devio.c+21−3
@@ -1434,10 +1434,13 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 1433 unmodified lines
14341434 struct async *as = NULL;
14351435 struct usb_ctrlrequest *dr = NULL;
14361436 unsigned int u, totlen, isofrmlen;
1437− int i, ret, is_in, num_sgs = 0, ifnum = -1;
1437+ int i, ret, num_sgs = 0, ifnum = -1;
14381438 int number_of_packets = 0;
14391439 unsigned int stream_id = 0;
14401440 void *buf;
1441+ bool is_in;
1442+ bool allow_short = false;
1443+ bool allow_zero = false;
14411444 unsigned long mask = USBDEVFS_URB_SHORT_NOT_OK |
14421445 USBDEVFS_URB_BULK_CONTINUATION |
14431446 USBDEVFS_URB_NO_FSBR |
@@ -1471,6 +1474,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 27 unmodified lines
14711474 u = 0;
14721475 switch (uurb->type) {
14731476 case USBDEVFS_URB_TYPE_CONTROL:
1477+ if (is_in)
1478+ allow_short = true;
14741479 if (!usb_endpoint_xfer_control(&ep->desc))
14751480 return -EINVAL;
14761481 /* min 8 byte setup packet */
@@ -1511,6 +1516,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 34 unmodified lines
15111516 break;
15121517
15131518 case USBDEVFS_URB_TYPE_BULK:
1519+ if (!is_in)
1520+ allow_zero = true;
1521+ else
1522+ allow_short = true;
15141523 switch (usb_endpoint_type(&ep->desc)) {
15151524 case USB_ENDPOINT_XFER_CONTROL:
15161525 case USB_ENDPOINT_XFER_ISOC:
@@ -1531,6 +1540,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 14 unmodified lines
15311540 if (!usb_endpoint_xfer_int(&ep->desc))
15321541 return -EINVAL;
15331542 interrupt_urb:
1543+ if (!is_in)
1544+ allow_zero = true;
1545+ else
1546+ allow_short = true;
15341547 break;
15351548
15361549 case USBDEVFS_URB_TYPE_ISO:
@@ -1676,14 +1689,19 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 139 unmodified lines
16761689 u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
16771690 if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
16781691 u |= URB_ISO_ASAP;
1679− if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in)
1692+ if (allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
16801693 u |= URB_SHORT_NOT_OK;
1681− if (uurb->flags & USBDEVFS_URB_ZERO_PACKET)
1694+ if (allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
16821695 u |= URB_ZERO_PACKET;
16831696 if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT)
16841697 u |= URB_NO_INTERRUPT;
16851698 as->urb->transfer_flags = u;
16861699
1700+ if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
1701+ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n");
1702+ if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
1703+ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n");
1704+
16871705 as->urb->transfer_buffer_length = uurb->buffer_length;
16881706 as->urb->setup_packet = (unsigned char *)dr;
16891707 dr = NULL;
drivers/usb/core/driver.c+14−14
@@ -512,7 +512,6 @@ int usb_driver_claim_interface(struct usb_driver *driver, · 511 unmodified lines
512512 struct device *dev;
513513 struct usb_device *udev;
514514 int retval = 0;
515− int lpm_disable_error = -ENODEV;
516515
517516 if (!iface)
518517 return -ENODEV;
@@ -533,16 +532,6 @@ int usb_driver_claim_interface(struct usb_driver *driver, · 14 unmodified lines
533532
534533 iface->condition = USB_INTERFACE_BOUND;
535534
536− /* See the comment about disabling LPM in usb_probe_interface(). */
537− if (driver->disable_hub_initiated_lpm) {
538− lpm_disable_error = usb_unlocked_disable_lpm(udev);
539− if (lpm_disable_error) {
540− dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n",
541− __func__, driver->name);
542− return -ENOMEM;
543− }
544− }
545−
546535 /* Claimed interfaces are initially inactive (suspended) and
547536 * runtime-PM-enabled, but only if the driver has autosuspend
548537 * support. Otherwise they are marked active, to prevent the
@@ -561,9 +550,20 @@ int usb_driver_claim_interface(struct usb_driver *driver, · 12 unmodified lines
561550 if (device_is_registered(dev))
562551 retval = device_bind_driver(dev);
563552
564− /* Attempt to re-enable USB3 LPM, if the disable was successful. */
565− if (!lpm_disable_error)
566− usb_unlocked_enable_lpm(udev);
553+ if (retval) {
554+ dev->driver = NULL;
555+ usb_set_intfdata(iface, NULL);
556+ iface->needs_remote_wakeup = 0;
557+ iface->condition = USB_INTERFACE_UNBOUND;
558+
559+ /*
560+ * Unbound interfaces are always runtime-PM-disabled
561+ * and runtime-PM-suspended
562+ */
563+ if (driver->supports_autosuspend)
564+ pm_runtime_disable(dev);
565+ pm_runtime_set_suspended(dev);
566+ }
567567
568568 return retval;
569569 }
drivers/usb/core/hcd-pci.c+0−2
@@ -515,8 +515,6 @@ static int resume_common(struct device *dev, int event) · 514 unmodified lines
515515 event == PM_EVENT_RESTORE);
516516 if (retval) {
517517 dev_err(dev, "PCI post-resume error %d!\n", retval);
518− if (hcd->shared_hcd)
519− usb_hc_died(hcd->shared_hcd);
520518 usb_hc_died(hcd);
521519 }
522520 }
drivers/usb/core/message.c+11−0
@@ -1341,6 +1341,11 @@ void usb_enable_interface(struct usb_device *dev, · 1340 unmodified lines
13411341 * is submitted that needs that bandwidth. Some other operating systems
13421342 * allocate bandwidth early, when a configuration is chosen.
13431343 *
1344+ * xHCI reserves bandwidth and configures the alternate setting in
1345+ * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting
1346+ * may be disabled. Drivers cannot rely on any particular alternate
1347+ * setting being in effect after a failure.
1348+ *
13441349 * This call is synchronous, and may not be used in an interrupt context.
13451350 * Also, drivers must not change altsettings while urbs are scheduled for
13461351 * endpoints in that interface; all such urbs must first be completed
@@ -1376,6 +1381,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) · 29 unmodified lines
13761381 alternate);
13771382 return -EINVAL;
13781383 }
1384+ /*
1385+ * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth,
1386+ * including freeing dropped endpoint ring buffers.
1387+ * Make sure the interface endpoints are flushed before that
1388+ */
1389+ usb_disable_interface(dev, iface, false);
13791390
13801391 /* Make sure we have enough bandwidth for this alternate interface.
13811392 * Remove the current alt setting and add the new alt setting.
drivers/usb/core/of.c+0−26
@@ -105,29 +105,3 @@ usb_of_get_interface_node(struct usb_device *udev, u8 config, u8 ifnum) · 104 unmodified lines
105105 return NULL;
106106 }
107107 EXPORT_SYMBOL_GPL(usb_of_get_interface_node);
108−
109−/**
110− * usb_of_get_companion_dev - Find the companion device
111− * @dev: the device pointer to find a companion
112− *
113− * Find the companion device from platform bus.
114− *
115− * Takes a reference to the returned struct device which needs to be dropped
116− * after use.
117− *
118− * Return: On success, a pointer to the companion device, %NULL on failure.
119− */
120−struct device *usb_of_get_companion_dev(struct device *dev)
121−{
122− struct device_node *node;
123− struct platform_device *pdev = NULL;
124−
125− node = of_parse_phandle(dev->of_node, "companion", 0);
126− if (node)
127− pdev = of_find_device_by_node(node);
128−
129− of_node_put(node);
130−
131− return pdev ? &pdev->dev : NULL;
132−}
133−EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);
drivers/usb/core/quirks.c+9−1
@@ -58,6 +58,7 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) · 57 unmodified lines
5858 quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
5959 GFP_KERNEL);
6060 if (!quirk_list) {
61+ quirk_count = 0;
6162 mutex_unlock(&quirk_mutex);
6263 return -ENOMEM;
6364 }
@@ -154,7 +155,7 @@ static struct kparam_string quirks_param_string = { · 90 unmodified lines
154155 .string = quirks_param,
155156 };
156157
157−module_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0644);
158+device_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0644);
158159 MODULE_PARM_DESC(quirks, "Add/modify USB quirks by specifying quirks=vendorID:productID:quirks");
159160
160161 /* Lists of quirky USB devices, split in device quirks and interface quirks.
@@ -178,6 +179,10 @@ static const struct usb_device_id usb_quirk_list[] = { · 17 unmodified lines
178179 /* CBM - Flash disk */
179180 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
180181
182+ /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */
183+ { USB_DEVICE(0x0218, 0x0201), .driver_info =
184+ USB_QUIRK_CONFIG_INTF_STRINGS },
185+
181186 /* WORLDE easy key (easykey.25) MIDI controller */
182187 { USB_DEVICE(0x0218, 0x0401), .driver_info =
183188 USB_QUIRK_CONFIG_INTF_STRINGS },
@@ -406,6 +411,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 222 unmodified lines
406411 { USB_DEVICE(0x2040, 0x7200), .driver_info =
407412 USB_QUIRK_CONFIG_INTF_STRINGS },
408413
414+ /* DJI CineSSD */
415+ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
416+
409417 /* INTEL VALUE SSD */
410418 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
411419
drivers/usb/core/usb.c+2−0
@@ -228,6 +228,8 @@ struct usb_host_interface *usb_find_alt_setting( · 227 unmodified lines
228228 struct usb_interface_cache *intf_cache = NULL;
229229 int i;
230230
231+ if (!config)
232+ return NULL;
231233 for (i = 0; i < config->desc.bNumInterfaces; i++) {
232234 if (config->intf_cache[i]->altsetting[0].desc.bInterfaceNumber
233235 == iface_num) {
drivers/usb/dwc2/platform.c+2−2
@@ -412,8 +412,6 @@ static int dwc2_driver_probe(struct platform_device *dev) · 411 unmodified lines
412412 dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n",
413413 (unsigned long)res->start, hsotg->regs);
414414
415− hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg);
416−
417415 retval = dwc2_lowlevel_hw_init(hsotg);
418416 if (retval)
419417 return retval;
@@ -438,6 +436,8 @@ static int dwc2_driver_probe(struct platform_device *dev) · 18 unmodified lines
438436 if (retval)
439437 return retval;
440438
439+ hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg);
440+
441441 retval = dwc2_get_dr_mode(hsotg);
442442 if (retval)
443443 goto error;
drivers/usb/dwc3/dwc3-of-simple.c+4−6
@@ -180,8 +180,7 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) · 179 unmodified lines
180180 return 0;
181181 }
182182
183−#ifdef CONFIG_PM
184−static int dwc3_of_simple_runtime_suspend(struct device *dev)
183+static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev)
185184 {
186185 struct dwc3_of_simple *simple = dev_get_drvdata(dev);
187186 int i;
@@ -192,7 +191,7 @@ static int dwc3_of_simple_runtime_suspend(struct device *dev) · 4 unmodified lines
192191 return 0;
193192 }
194193
195−static int dwc3_of_simple_runtime_resume(struct device *dev)
194+static int __maybe_unused dwc3_of_simple_runtime_resume(struct device *dev)
196195 {
197196 struct dwc3_of_simple *simple = dev_get_drvdata(dev);
198197 int ret;
@@ -210,7 +209,7 @@ static int dwc3_of_simple_runtime_resume(struct device *dev) · 11 unmodified lines
210209 return 0;
211210 }
212211
213−static int dwc3_of_simple_suspend(struct device *dev)
212+static int __maybe_unused dwc3_of_simple_suspend(struct device *dev)
214213 {
215214 struct dwc3_of_simple *simple = dev_get_drvdata(dev);
216215
@@ -220,7 +219,7 @@ static int dwc3_of_simple_suspend(struct device *dev) · 3 unmodified lines
220219 return 0;
221220 }
222221
223−static int dwc3_of_simple_resume(struct device *dev)
222+static int __maybe_unused dwc3_of_simple_resume(struct device *dev)
224223 {
225224 struct dwc3_of_simple *simple = dev_get_drvdata(dev);
226225
@@ -229,7 +228,6 @@ static int dwc3_of_simple_resume(struct device *dev) · 2 unmodified lines
229228
230229 return 0;
231230 }
232−#endif
233231
234232 static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = {
235233 SET_SYSTEM_SLEEP_PM_OPS(dwc3_of_simple_suspend, dwc3_of_simple_resume)
drivers/usb/dwc3/dwc3-pci.c+2−2
@@ -85,8 +85,8 @@ static int dwc3_byt_enable_ulpi_refclock(struct pci_dev *pci) · 84 unmodified lines
8585 u32 value;
8686
8787 reg = pcim_iomap(pci, GP_RWBAR, 0);
88− if (IS_ERR(reg))
89− return PTR_ERR(reg);
88+ if (!reg)
89+ return -ENOMEM;
9090
9191 value = readl(reg + GP_RWREG1);
9292 if (!(value & GP_RWREG1_ULPI_REFCLK_DISABLE))
drivers/usb/dwc3/gadget.c+0−1
@@ -473,7 +473,6 @@ static int dwc3_gadget_set_xfer_resource(struct dwc3_ep *dep) · 472 unmodified lines
473473
474474 /**
475475 * dwc3_gadget_start_config - configure ep resources
476− * @dwc: pointer to our controller context structure
477476 * @dep: endpoint that is being enabled
478477 *
479478 * Issue a %DWC3_DEPCMD_DEPSTARTCFG command to @dep. After the command's
drivers/usb/gadget/udc/fotg210-udc.c+10−5
@@ -1063,12 +1063,15 @@ static const struct usb_gadget_ops fotg210_gadget_ops = { · 1062 unmodified lines
10631063 static int fotg210_udc_remove(struct platform_device *pdev)
10641064 {
10651065 struct fotg210_udc *fotg210 = platform_get_drvdata(pdev);
1066+ int i;
10661067
10671068 usb_del_gadget_udc(&fotg210->gadget);
10681069 iounmap(fotg210->reg);
10691070 free_irq(platform_get_irq(pdev, 0), fotg210);
10701071
10711072 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
1073+ for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
1074+ kfree(fotg210->ep[i]);
10721075 kfree(fotg210);
10731076
10741077 return 0;
@@ -1099,7 +1102,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) · 24 unmodified lines
10991102 /* initialize udc */
11001103 fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL);
11011104 if (fotg210 == NULL)
1102− goto err_alloc;
1105+ goto err;
11031106
11041107 for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
11051108 _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
@@ -1111,7 +1114,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) · 5 unmodified lines
11111114 fotg210->reg = ioremap(res->start, resource_size(res));
11121115 if (fotg210->reg == NULL) {
11131116 pr_err("ioremap error.\n");
1114− goto err_map;
1117+ goto err_alloc;
11151118 }
11161119
11171120 spin_lock_init(&fotg210->lock);
@@ -1159,7 +1162,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) · 41 unmodified lines
11591162 fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep,
11601163 GFP_KERNEL);
11611164 if (fotg210->ep0_req == NULL)
1162− goto err_req;
1165+ goto err_map;
11631166
11641167 fotg210_init(fotg210);
11651168
@@ -1187,12 +1190,14 @@ err_req: · 21 unmodified lines
11871190 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
11881191
11891192 err_map:
1190− if (fotg210->reg)
1191− iounmap(fotg210->reg);
1193+ iounmap(fotg210->reg);
11921194
11931195 err_alloc:
1196+ for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
1197+ kfree(fotg210->ep[i]);
11941198 kfree(fotg210);
11951199
1200+err:
11961201 return ret;
11971202 }
11981203
drivers/usb/gadget/udc/net2280.c+14−2
@@ -1545,11 +1545,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on) · 1544 unmodified lines
15451545 writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
15461546 } else {
15471547 writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
1548− stop_activity(dev, dev->driver);
1548+ stop_activity(dev, NULL);
15491549 }
15501550
15511551 spin_unlock_irqrestore(&dev->lock, flags);
15521552
1553+ if (!is_on && dev->driver)
1554+ dev->driver->disconnect(&dev->gadget);
1555+
15531556 return 0;
15541557 }
15551558
@@ -2466,8 +2469,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver) · 910 unmodified lines
24662469 nuke(&dev->ep[i]);
24672470
24682471 /* report disconnect; the driver is already quiesced */
2469− if (driver)
2472+ if (driver) {
2473+ spin_unlock(&dev->lock);
24702474 driver->disconnect(&dev->gadget);
2475+ spin_lock(&dev->lock);
2476+ }
24712477
24722478 usb_reinit(dev);
24732479 }
@@ -3341,6 +3347,8 @@ next_endpoints: · 867 unmodified lines
33413347 BIT(PCI_RETRY_ABORT_INTERRUPT))
33423348
33433349 static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3350+__releases(dev->lock)
3351+__acquires(dev->lock)
33443352 {
33453353 struct net2280_ep *ep;
33463354 u32 tmp, num, mask, scratch;
@@ -3381,12 +3389,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) · 34 unmodified lines
33813389 if (disconnect || reset) {
33823390 stop_activity(dev, dev->driver);
33833391 ep0_start(dev);
3392+ spin_unlock(&dev->lock);
33843393 if (reset)
33853394 usb_gadget_udc_reset
33863395 (&dev->gadget, dev->driver);
33873396 else
33883397 (dev->driver->disconnect)
33893398 (&dev->gadget);
3399+ spin_lock(&dev->lock);
33903400 return;
33913401 }
33923402 }
@@ -3405,6 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) · 12 unmodified lines
34053415 tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT);
34063416 if (stat & tmp) {
34073417 writel(tmp, &dev->regs->irqstat1);
3418+ spin_unlock(&dev->lock);
34083419 if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) {
34093420 if (dev->driver->suspend)
34103421 dev->driver->suspend(&dev->gadget);
@@ -3415,6 +3426,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) · 4 unmodified lines
34153426 dev->driver->resume(&dev->gadget);
34163427 /* at high speed, note erratum 0133 */
34173428 }
3429+ spin_lock(&dev->lock);
34183430 stat &= ~tmp;
34193431 }
34203432
drivers/usb/gadget/udc/renesas_usb3.c+4−1
@@ -812,12 +812,15 @@ static void usb3_irq_epc_int_1_speed(struct renesas_usb3 *usb3) · 811 unmodified lines
812812 switch (speed) {
813813 case USB_STA_SPEED_SS:
814814 usb3->gadget.speed = USB_SPEED_SUPER;
815+ usb3->gadget.ep0->maxpacket = USB3_EP0_SS_MAX_PACKET_SIZE;
815816 break;
816817 case USB_STA_SPEED_HS:
817818 usb3->gadget.speed = USB_SPEED_HIGH;
819+ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
818820 break;
819821 case USB_STA_SPEED_FS:
820822 usb3->gadget.speed = USB_SPEED_FULL;
823+ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
821824 break;
822825 default:
823826 usb3->gadget.speed = USB_SPEED_UNKNOWN;
@@ -2513,7 +2516,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev, · 1689 unmodified lines
25132516 /* for control pipe */
25142517 usb3->gadget.ep0 = &usb3_ep->ep;
25152518 usb_ep_set_maxpacket_limit(&usb3_ep->ep,
2516− USB3_EP0_HSFS_MAX_PACKET_SIZE);
2519+ USB3_EP0_SS_MAX_PACKET_SIZE);
25172520 usb3_ep->ep.caps.type_control = true;
25182521 usb3_ep->ep.caps.dir_in = true;
25192522 usb3_ep->ep.caps.dir_out = true;
drivers/usb/host/u132-hcd.c+1−1
@@ -2555,7 +2555,7 @@ static int u132_get_frame(struct usb_hcd *hcd) · 2554 unmodified lines
25552555 } else {
25562556 int frame = 0;
25572557 dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
2558− msleep(100);
2558+ mdelay(100);
25592559 return frame;
25602560 }
25612561 }
drivers/usb/host/xhci-mem.c+4−0
@@ -1613,6 +1613,10 @@ void xhci_endpoint_copy(struct xhci_hcd *xhci, · 1612 unmodified lines
16131613 in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2;
16141614 in_ep_ctx->deq = out_ep_ctx->deq;
16151615 in_ep_ctx->tx_info = out_ep_ctx->tx_info;
1616+ if (xhci->quirks & XHCI_MTK_HOST) {
1617+ in_ep_ctx->reserved[0] = out_ep_ctx->reserved[0];
1618+ in_ep_ctx->reserved[1] = out_ep_ctx->reserved[1];
1619+ }
16161620 }
16171621
16181622 /* Copy output xhci_slot_ctx to the input xhci_slot_ctx.
drivers/usb/host/xhci-plat.c+16−11
@@ -153,7 +153,7 @@ static int xhci_plat_probe(struct platform_device *pdev) · 152 unmodified lines
153153 {
154154 const struct xhci_plat_priv *priv_match;
155155 const struct hc_driver *driver;
156− struct device *sysdev;
156+ struct device *sysdev, *tmpdev;
157157 struct xhci_hcd *xhci;
158158 struct resource *res;
159159 struct usb_hcd *hcd;
@@ -273,19 +273,24 @@ static int xhci_plat_probe(struct platform_device *pdev) · 113 unmodified lines
273273 goto disable_clk;
274274 }
275275
276− if (device_property_read_bool(sysdev, "usb2-lpm-disable"))
277− xhci->quirks |= XHCI_HW_LPM_DISABLE;
276+ /* imod_interval is the interrupt moderation value in nanoseconds. */
277+ xhci->imod_interval = 40000;
278278
279− if (device_property_read_bool(sysdev, "usb3-lpm-capable"))
280− xhci->quirks |= XHCI_LPM_SUPPORT;
279+ /* Iterate over all parent nodes for finding quirks */
280+ for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) {
281281
282− if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
283− xhci->quirks |= XHCI_BROKEN_PORT_PED;
282+ if (device_property_read_bool(tmpdev, "usb2-lpm-disable"))
283+ xhci->quirks |= XHCI_HW_LPM_DISABLE;
284284
285− /* imod_interval is the interrupt moderation value in nanoseconds. */
286− xhci->imod_interval = 40000;
287− device_property_read_u32(sysdev, "imod-interval-ns",
288− &xhci->imod_interval);
285+ if (device_property_read_bool(tmpdev, "usb3-lpm-capable"))
286+ xhci->quirks |= XHCI_LPM_SUPPORT;
287+
288+ if (device_property_read_bool(tmpdev, "quirk-broken-port-ped"))
289+ xhci->quirks |= XHCI_BROKEN_PORT_PED;
290+
291+ device_property_read_u32(tmpdev, "imod-interval-ns",
292+ &xhci->imod_interval);
293+ }
289294
290295 hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
291296 if (IS_ERR(hcd->usb_phy)) {
drivers/usb/host/xhci.c+30−0
@@ -37,6 +37,21 @@ static unsigned long long quirks; · 36 unmodified lines
3737 module_param(quirks, ullong, S_IRUGO);
3838 MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
3939
40+static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
41+{
42+ struct xhci_segment *seg = ring->first_seg;
43+
44+ if (!td || !td->start_seg)
45+ return false;
46+ do {
47+ if (seg == td->start_seg)
48+ return true;
49+ seg = seg->next;
50+ } while (seg && seg != ring->first_seg);
51+
52+ return false;
53+}
54+
4055 /* TODO: copied from ehci-hcd.c - can this be refactored? */
4156 /*
4257 * xhci_handshake - spin reading hc until handshake completes or fails
@@ -1571,6 +1586,21 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) · 1528 unmodified lines
15711586 goto done;
15721587 }
15731588
1589+ /*
1590+ * check ring is not re-allocated since URB was enqueued. If it is, then
1591+ * make sure none of the ring related pointers in this URB private data
1592+ * are touched, such as td_list, otherwise we overwrite freed data
1593+ */
1594+ if (!td_on_ring(&urb_priv->td[0], ep_ring)) {
1595+ xhci_err(xhci, "Canceled URB td not found on endpoint ring");
1596+ for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) {
1597+ td = &urb_priv->td[i];
1598+ if (!list_empty(&td->cancelled_td_list))
1599+ list_del_init(&td->cancelled_td_list);
1600+ }
1601+ goto err_giveback;
1602+ }
1603+
15741604 if (xhci->xhc_state & XHCI_STATE_HALTED) {
15751605 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
15761606 "HC halted, freeing TD manually.");
drivers/usb/misc/uss720.c+2−2
@@ -369,7 +369,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch · 368 unmodified lines
369369 mask &= 0x0f;
370370 val &= 0x0f;
371371 d = (priv->reg[1] & (~mask)) ^ val;
372− if (set_1284_register(pp, 2, d, GFP_KERNEL))
372+ if (set_1284_register(pp, 2, d, GFP_ATOMIC))
373373 return 0;
374374 priv->reg[1] = d;
375375 return d & 0xf;
@@ -379,7 +379,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp) · 3 unmodified lines
379379 {
380380 unsigned char ret;
381381
382− if (get_1284_register(pp, 1, &ret, GFP_KERNEL))
382+ if (get_1284_register(pp, 1, &ret, GFP_ATOMIC))
383383 return 0;
384384 return ret & 0xf8;
385385 }
drivers/usb/misc/yurex.c+6−2
@@ -413,6 +413,9 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, · 412 unmodified lines
413413 spin_unlock_irqrestore(&dev->lock, flags);
414414 mutex_unlock(&dev->io_mutex);
415415
416+ if (WARN_ON_ONCE(len >= sizeof(in_buffer)))
417+ return -EIO;
418+
416419 return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
417420 }
418421
@@ -421,13 +424,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, · 2 unmodified lines
421424 {
422425 struct usb_yurex *dev;
423426 int i, set = 0, retval = 0;
424− char buffer[16];
427+ char buffer[16 + 1];
425428 char *data = buffer;
426429 unsigned long long c, c2 = 0;
427430 signed long timeout = 0;
428431 DEFINE_WAIT(wait);
429432
430− count = min(sizeof(buffer), count);
433+ count = min(sizeof(buffer) - 1, count);
431434 dev = file->private_data;
432435
433436 /* verify that we actually have some data to write */
@@ -446,6 +449,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, · 12 unmodified lines
446449 retval = -EFAULT;
447450 goto error;
448451 }
452+ buffer[count] = 0;
449453 memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
450454
451455 switch (buffer[0]) {
drivers/usb/mtu3/mtu3_core.c+5−1
@@ -107,8 +107,12 @@ static int mtu3_device_enable(struct mtu3 *mtu) · 106 unmodified lines
107107 (SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN |
108108 SSUSB_U2_PORT_HOST_SEL));
109109
110− if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG)
110+ if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) {
111111 mtu3_setbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL);
112+ if (mtu->is_u3_ip)
113+ mtu3_setbits(ibase, SSUSB_U3_CTRL(0),
114+ SSUSB_U3_PORT_DUAL_MODE);
115+ }
112116
113117 return ssusb_check_clocks(mtu->ssusb, check_clk);
114118 }
drivers/usb/mtu3/mtu3_hw_regs.h+1−0
@@ -459,6 +459,7 @@ · 458 unmodified lines
459459
460460 /* U3D_SSUSB_U3_CTRL_0P */
461461 #define SSUSB_U3_PORT_SSP_SPEED BIT(9)
462+#define SSUSB_U3_PORT_DUAL_MODE BIT(7)
462463 #define SSUSB_U3_PORT_HOST_SEL BIT(2)
463464 #define SSUSB_U3_PORT_PDN BIT(1)
464465 #define SSUSB_U3_PORT_DIS BIT(0)
drivers/usb/musb/musb_dsps.c+1−11
@@ -658,16 +658,6 @@ dsps_dma_controller_create(struct musb *musb, void __iomem *base) · 657 unmodified lines
658658 return controller;
659659 }
660660
661−static void dsps_dma_controller_destroy(struct dma_controller *c)
662−{
663− struct musb *musb = c->musb;
664− struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
665− void __iomem *usbss_base = glue->usbss_base;
666−
667− musb_writel(usbss_base, USBSS_IRQ_CLEARR, USBSS_IRQ_PD_COMP);
668− cppi41_dma_controller_destroy(c);
669−}
670−
671661 #ifdef CONFIG_PM_SLEEP
672662 static void dsps_dma_controller_suspend(struct dsps_glue *glue)
673663 {
@@ -697,7 +687,7 @@ static struct musb_platform_ops dsps_ops = { · 23 unmodified lines
697687
698688 #ifdef CONFIG_USB_TI_CPPI41_DMA
699689 .dma_init = dsps_dma_controller_create,
700− .dma_exit = dsps_dma_controller_destroy,
690+ .dma_exit = cppi41_dma_controller_destroy,
701691 #endif
702692 .enable = dsps_musb_enable,
703693 .disable = dsps_musb_disable,
drivers/usb/serial/io_ti.h+1−1
@@ -173,7 +173,7 @@ struct ump_interrupt { · 172 unmodified lines
173173 } __attribute__((packed));
174174
175175
176−#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
176+#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
177177 #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
178178 #define TIUMP_INTERRUPT_CODE_LSR 0x03
179179 #define TIUMP_INTERRUPT_CODE_MSR 0x04
drivers/usb/serial/ti_usb_3410_5052.c+1−1
@@ -1119,7 +1119,7 @@ static void ti_break(struct tty_struct *tty, int break_state) · 1118 unmodified lines
11191119
11201120 static int ti_get_port_from_code(unsigned char code)
11211121 {
1122− return (code >> 4) - 3;
1122+ return (code >> 6) & 0x01;
11231123 }
11241124
11251125 static int ti_get_func_from_code(unsigned char code)
drivers/usb/storage/scsiglue.c+9−0
@@ -376,6 +376,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb, · 375 unmodified lines
376376 return 0;
377377 }
378378
379+ if ((us->fflags & US_FL_NO_ATA_1X) &&
380+ (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
381+ memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
382+ sizeof(usb_stor_sense_invalidCDB));
383+ srb->result = SAM_STAT_CHECK_CONDITION;
384+ done(srb);
385+ return 0;
386+ }
387+
379388 /* enqueue the command and wake up the control thread */
380389 srb->scsi_done = done;
381390 us->srb = srb;
drivers/usb/storage/uas.c+21−0
@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev) · 841 unmodified lines
842842 sdev->skip_ms_page_8 = 1;
843843 sdev->wce_default_on = 1;
844844 }
845+
846+ /*
847+ * Some disks return the total number of blocks in response
848+ * to READ CAPACITY rather than the highest block number.
849+ * If this device makes that mistake, tell the sd driver.
850+ */
851+ if (devinfo->flags & US_FL_FIX_CAPACITY)
852+ sdev->fix_capacity = 1;
853+
854+ /*
855+ * Some devices don't like MODE SENSE with page=0x3f,
856+ * which is the command used for checking if a device
857+ * is write-protected. Now that we tell the sd driver
858+ * to do a 192-byte transfer with this command the
859+ * majority of devices work fine, but a few still can't
860+ * handle it. The sd driver will simply assume those
861+ * devices are write-enabled.
862+ */
863+ if (devinfo->flags & US_FL_NO_WP_DETECT)
864+ sdev->skip_ms_page_3f = 1;
865+
845866 scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
846867 return 0;
847868 }
drivers/usb/storage/unusual_devs.h+7−0
@@ -2288,6 +2288,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, · 2287 unmodified lines
22882288 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
22892289 US_FL_GO_SLOW ),
22902290
2291+/* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */
2292+UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999,
2293+ "DJI",
2294+ "CineSSD",
2295+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2296+ US_FL_NO_ATA_1X),
2297+
22912298 /*
22922299 * Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
22932300 * Mio Moov 330
drivers/usb/typec/bus.c+4−3
@@ -255,12 +255,13 @@ EXPORT_SYMBOL_GPL(typec_altmode_unregister_driver); · 254 unmodified lines
255255 /* API for the port drivers */
256256
257257 /**
258− * typec_match_altmode - Match SVID to an array of alternate modes
258+ * typec_match_altmode - Match SVID and mode to an array of alternate modes
259259 * @altmodes: Array of alternate modes
260− * @n: Number of elements in the array, or -1 for NULL termiated arrays
260+ * @n: Number of elements in the array, or -1 for NULL terminated arrays
261261 * @svid: Standard or Vendor ID to match with
262+ * @mode: Mode to match with
262263 *
263− * Return pointer to an alternate mode with SVID mathing @svid, or NULL when no
264+ * Return pointer to an alternate mode with SVID matching @svid, or NULL when no
264265 * match is found.
265266 */
266267 struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes,
drivers/usb/typec/class.c+0−1
@@ -1484,7 +1484,6 @@ EXPORT_SYMBOL_GPL(typec_set_mode); · 1483 unmodified lines
14841484 * typec_port_register_altmode - Register USB Type-C Port Alternate Mode
14851485 * @port: USB Type-C Port that supports the alternate mode
14861486 * @desc: Description of the alternate mode
1487− * @drvdata: Private pointer to driver specific info
14881487 *
14891488 * This routine is used to register an alternate mode that @port is capable of
14901489 * supporting.
drivers/usb/typec/mux.c+13−4
@@ -9,6 +9,7 @@ · 8 unmodified lines
99
1010 #include <linux/device.h>
1111 #include <linux/list.h>
12+#include <linux/module.h>
1213 #include <linux/mutex.h>
1314 #include <linux/usb/typec_mux.h>
1415
@@ -49,8 +50,10 @@ struct typec_switch *typec_switch_get(struct device *dev) · 34 unmodified lines
4950 mutex_lock(&switch_lock);
5051 sw = device_connection_find_match(dev, "typec-switch", NULL,
5152 typec_switch_match);
52− if (!IS_ERR_OR_NULL(sw))
53+ if (!IS_ERR_OR_NULL(sw)) {
54+ WARN_ON(!try_module_get(sw->dev->driver->owner));
5355 get_device(sw->dev);
56+ }
5457 mutex_unlock(&switch_lock);
5558
5659 return sw;
@@ -65,8 +68,10 @@ EXPORT_SYMBOL_GPL(typec_switch_get); · 8 unmodified lines
6568 */
6669 void typec_switch_put(struct typec_switch *sw)
6770 {
68− if (!IS_ERR_OR_NULL(sw))
71+ if (!IS_ERR_OR_NULL(sw)) {
72+ module_put(sw->dev->driver->owner);
6973 put_device(sw->dev);
74+ }
7075 }
7176 EXPORT_SYMBOL_GPL(typec_switch_put);
7277
@@ -136,8 +141,10 @@ struct typec_mux *typec_mux_get(struct device *dev, const char *name) · 63 unmodified lines
136141
137142 mutex_lock(&mux_lock);
138143 mux = device_connection_find_match(dev, name, NULL, typec_mux_match);
139− if (!IS_ERR_OR_NULL(mux))
144+ if (!IS_ERR_OR_NULL(mux)) {
145+ WARN_ON(!try_module_get(mux->dev->driver->owner));
140146 get_device(mux->dev);
147+ }
141148 mutex_unlock(&mux_lock);
142149
143150 return mux;
@@ -152,8 +159,10 @@ EXPORT_SYMBOL_GPL(typec_mux_get); · 8 unmodified lines
152159 */
153160 void typec_mux_put(struct typec_mux *mux)
154161 {
155− if (!IS_ERR_OR_NULL(mux))
162+ if (!IS_ERR_OR_NULL(mux)) {
163+ module_put(mux->dev->driver->owner);
156164 put_device(mux->dev);
165+ }
157166 }
158167 EXPORT_SYMBOL_GPL(typec_mux_put);
159168
drivers/xen/Kconfig+7−3
@@ -79,15 +79,19 @@ config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT · 78 unmodified lines
7979 This value is used to allocate enough space in internal
8080 tables needed for physical memory administration.
8181
82−config XEN_SCRUB_PAGES
83− bool "Scrub pages before returning them to system"
82+config XEN_SCRUB_PAGES_DEFAULT
83+ bool "Scrub pages before returning them to system by default"
8484 depends on XEN_BALLOON
8585 default y
8686 help
8787 Scrub pages before returning them to the system for reuse by
8888 other domains. This makes sure that any confidential data
8989 is not accidentally visible to other domains. Is it more
90− secure, but slightly less efficient.
90+ secure, but slightly less efficient. This can be controlled with
91+ xen_scrub_pages=0 parameter and
92+ /sys/devices/system/xen_memory/xen_memory0/scrub_pages.
93+ This option only sets the default value.
94+
9195 If in doubt, say yes.
9296
9397 config XEN_DEV_EVTCHN
drivers/xen/cpu_hotplug.c+8−7
@@ -19,15 +19,16 @@ static void enable_hotplug_cpu(int cpu) · 18 unmodified lines
1919
2020 static void disable_hotplug_cpu(int cpu)
2121 {
22− if (cpu_online(cpu)) {
23− lock_device_hotplug();
22+ if (!cpu_is_hotpluggable(cpu))
23+ return;
24+ lock_device_hotplug();
25+ if (cpu_online(cpu))
2426 device_offline(get_cpu_device(cpu));
25− unlock_device_hotplug();
26− }
27− if (cpu_present(cpu))
27+ if (!cpu_online(cpu) && cpu_present(cpu)) {
2828 xen_arch_unregister_cpu(cpu);
29−
30− set_cpu_present(cpu, false);
29+ set_cpu_present(cpu, false);
30+ }
31+ unlock_device_hotplug();
3132 }
3233
3334 static int vcpu_online(unsigned int cpu)
drivers/xen/events/events_base.c+1−1
@@ -138,7 +138,7 @@ static int set_evtchn_to_irq(unsigned evtchn, unsigned irq) · 137 unmodified lines
138138 clear_evtchn_to_irq_row(row);
139139 }
140140
141− evtchn_to_irq[EVTCHN_ROW(evtchn)][EVTCHN_COL(evtchn)] = irq;
141+ evtchn_to_irq[row][col] = irq;

3 more lines aren’t shown here.

drivers/xen/gntdev.c+15−11

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

drivers/xen/grant-table.c+21−6

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

drivers/xen/manage.c+4−2

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

drivers/xen/mem-reservation.c+4−0

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

drivers/xen/xen-balloon.c+3−0

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

fs/afs/proc.c+7−8

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

fs/ceph/super.c+11−5

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

fs/cifs/Kconfig+1−0

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

fs/cifs/cifs_unicode.c+0−3

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

fs/cifs/cifssmb.c+8−3

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

fs/cifs/connect.c+1−1

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

fs/cifs/inode.c+2−0

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

fs/cifs/misc.c+8−0

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

fs/cifs/readdir.c+9−2

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

fs/cifs/smb2misc.c+9−5

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

fs/cifs/smb2ops.c+25−10

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

fs/cifs/smb2pdu.c+20−12

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

fs/dax.c+3−11

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

fs/ext2/inode.c+1−1

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

fs/ext4/dir.c+9−11

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

fs/ext4/ext4.h+17−3

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

fs/ext4/inline.c+3−1

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

fs/ext4/inode.c+11−9

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

fs/ext4/mmp.c+0−1

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

fs/ext4/namei.c+6−0

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

fs/ext4/resize.c+22−1

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

fs/ext4/super.c+4−0

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

fs/nfs/nfs4proc.c+19−12

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

fs/nfs/nfs4state.c+2−0

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

fs/nfs/nfs4trace.h+2−2

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

fs/nfs/pnfs.c+16−10

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

fs/notify/fsnotify.c+3−10

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

fs/ocfs2/buffer_head_io.c+1−0

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

fs/overlayfs/file.c+20−3

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

fs/overlayfs/inode.c+10−0

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

fs/overlayfs/super.c+14−12

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

fs/proc/kcore.c+1−0

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

fs/pstore/ram_core.c+14−3

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

fs/ubifs/super.c+6−1

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

fs/ubifs/xattr.c+0−24

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

include/asm-generic/io.h+2−1

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

include/drm/drm_drv.h+1−1

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

include/drm/drm_panel.h+0−1

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

include/linux/blkdev.h+1−1

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

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

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

include/linux/compiler_types.h+8−0

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

include/linux/fs.h+5−0

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

include/linux/genhd.h+4−1

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

include/linux/hid.h+1−0

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

include/linux/kvm_host.h+0−2

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

include/linux/mfd/da9063/pdata.h+9−7

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

include/linux/mfd/rohm-bd718x7.h+30−3

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

include/linux/mlx5/driver.h+4−4

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

include/linux/mm_types.h+1−1

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

include/linux/mm_types_task.h+1−1

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

include/linux/mod_devicetable.h+1−0

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

include/linux/netpoll.h+3−2

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

include/linux/pci.h+3−0

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

include/linux/regulator/machine.h+3−3

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

include/linux/spi/spi-mem.h+4−3

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

include/linux/stmmac.h+1−0

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

include/linux/timekeeping.h+2−2

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

include/linux/uio.h+1−1

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

include/linux/vga_switcheroo.h+3−0

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

include/linux/vm_event_item.h+0−1

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

include/linux/vmacache.h+0−5

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

include/net/netfilter/nf_conntrack_timeout.h+1−1

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

include/net/nfc/hci.h+1−1

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

include/net/tls.h+9−10

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

include/sound/hdaudio.h+1−0

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

include/sound/soc-dapm.h+1−0

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

include/uapi/linux/keyctl.h+1−1

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

include/uapi/linux/kvm.h+1−0

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

include/uapi/linux/perf_event.h+1−1

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

include/uapi/sound/skl-tplg-interface.h+54−52

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

include/xen/mem-reservation.h+4−3

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

kernel/bpf/btf.c+1−1

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

kernel/bpf/sockmap.c+71−20

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

kernel/bpf/verifier.c+1−1

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

kernel/cpu.c+6−5

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

kernel/dma/Kconfig+3−0

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

kernel/events/core.c+13−8

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

kernel/events/hw_breakpoint.c+6−7

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

kernel/jump_label.c+1−1

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

kernel/locking/lockdep.c+0−1

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

kernel/locking/mutex.c+1−2

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

kernel/locking/test-ww_mutex.c+1−1

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

kernel/pid.c+1−1

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

kernel/printk/printk.c+5−7

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

kernel/sched/debug.c+4−2

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

kernel/sched/fair.c+17−9

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

kernel/sched/topology.c+1−4

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

kernel/sys.c+0−3

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

kernel/time/clocksource.c+30−10

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

kernel/trace/ring_buffer.c+2−0

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

mm/Kconfig+1−0

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

mm/Makefile+1−2

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

mm/debug.c+2−2

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

mm/fadvise.c+48−33

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

mm/readahead.c+17−28

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

mm/shmem.c+2−0

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

mm/vmacache.c+0−38

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

mm/vmscan.c+11−0

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

net/batman-adv/bat_v_elp.c+7−3

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

net/batman-adv/bridge_loop_avoidance.c+8−2

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

net/batman-adv/gateway_client.c+9−2

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

net/batman-adv/main.h+1−1

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

net/batman-adv/network-coding.c+15−12

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

net/batman-adv/soft-interface.c+18−7

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

net/batman-adv/sysfs.c+20−10

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

net/batman-adv/translation-table.c+4−2

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

net/batman-adv/tvlv.c+6−2

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

net/bluetooth/smp.c+13−3

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

net/core/devlink.c+1−2

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

net/core/ethtool.c+1−0

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

net/core/filter.c+2−1

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

net/core/neighbour.c+8−5

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

net/core/netpoll.c+7−12

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

net/core/rtnetlink.c+1−1

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

net/core/skbuff.c+0−3

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

net/ipv4/af_inet.c+1−0

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

net/ipv4/ip_fragment.c+1−0

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

net/ipv4/ip_gre.c+5−0

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

net/ipv4/ip_tunnel.c+9−0

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

net/ipv4/netfilter/Kconfig+5−3

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

net/ipv4/tcp.c+1−1

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

net/ipv4/tcp_input.c+2−2

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

net/ipv4/udp.c+26−23

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

net/ipv6/addrconf.c+1−3

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

net/ipv6/ip6_offload.c+1−0

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

net/ipv6/ip6_output.c+2−4

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

net/ipv6/ip6_tunnel.c+11−2

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

net/ipv6/netfilter/nf_conntrack_reasm.c+1−0

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

net/ipv6/route.c+38−15

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

net/ipv6/udp.c+37−28

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

net/iucv/af_iucv.c+25−13

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

net/iucv/iucv.c+1−1

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

net/mpls/af_mpls.c+5−1

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

net/netfilter/Kconfig+6−6

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

net/netfilter/nf_conntrack_proto.c+26−0

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

net/netfilter/nf_conntrack_proto_dccp.c+13−6

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

net/netfilter/nf_conntrack_proto_generic.c+4−4

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

net/netfilter/nf_conntrack_proto_gre.c+4−4

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

net/netfilter/nf_conntrack_proto_icmp.c+4−4

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

net/netfilter/nf_conntrack_proto_icmpv6.c+4−4

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

net/netfilter/nf_conntrack_proto_sctp.c+14−7

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

net/netfilter/nf_conntrack_proto_tcp.c+13−6

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

net/netfilter/nf_conntrack_proto_udp.c+10−11

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

net/netfilter/nf_tables_api.c+1−0

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

net/netfilter/nfnetlink_cttimeout.c+3−3

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

net/netfilter/nfnetlink_queue.c+1−0

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

net/netfilter/nft_ct.c+29−30

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

net/netfilter/xt_CHECKSUM.c+21−1

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

net/netfilter/xt_cluster.c+13−1

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

net/netfilter/xt_hashlimit.c+9−9

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

net/netlabel/netlabel_unlabeled.c+2−1

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

net/nfc/hci/core.c+10−0

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

net/rds/bind.c+4−1

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

net/rds/ib.h+1−1

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

net/sched/act_sample.c+1−1

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

net/sched/act_tunnel_key.c+18−10

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

net/sched/cls_api.c+2−0

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

net/sctp/transport.c+10−2

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

net/smc/af_smc.c+16−10

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

net/smc/smc_clc.c+6−8

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

net/smc/smc_close.c+7−7

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

net/smc/smc_pnet.c+1−1

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

net/socket.c+14−8

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

net/tipc/netlink_compat.c+5−0

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

net/tipc/socket.c+12−6

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

net/tipc/socket.h+1−0

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

net/tls/tls_device.c+3−3

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

net/tls/tls_device_fallback.c+1−1

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

net/tls/tls_main.c+16−6

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

net/tls/tls_sw.c+19−8

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

scripts/depmod.sh+3−2

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

scripts/kconfig/Makefile+0−1

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

scripts/kconfig/check-pkgconfig.sh+0−8

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

scripts/kconfig/gconf-cfg.sh+7−0

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

scripts/kconfig/mconf-cfg.sh+14−11

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

scripts/kconfig/mconf.c+0−1

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

scripts/kconfig/nconf-cfg.sh+14−11

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

scripts/kconfig/qconf-cfg.sh+7−0

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

scripts/setlocalversion+1−1

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

scripts/subarch.include+13−0

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

security/Kconfig+1−1

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

security/keys/dh.c+1−1

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

sound/core/rawmidi.c+2−2

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

sound/firewire/bebob/bebob.c+2−0

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

sound/firewire/bebob/bebob_maudio.c+14−14

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

sound/firewire/digi00x/digi00x.c+1−0

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

sound/firewire/fireface/ff-protocol-ff400.c+6−3

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

sound/firewire/fireworks/fireworks.c+2−0

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

sound/firewire/oxfw/oxfw.c+10−0

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

sound/firewire/tascam/tascam.c+1−0

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

sound/hda/ext/hdac_ext_stream.c+7−15

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

sound/hda/hdac_controller.c+10−5

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

sound/pci/emu10k1/emufx.c+1−1

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

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

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

sound/pci/hda/hda_intel.c+63−23

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

sound/pci/hda/hda_intel.h+1−0

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

sound/soc/amd/acp-pcm-dma.c+21−0

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

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

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

sound/soc/codecs/max98373.c+3−0

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

sound/soc/codecs/rt5514.c+4−4

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

sound/soc/codecs/rt5682.c+4−4

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

sound/soc/codecs/sigmadsp.c+1−2

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

sound/soc/codecs/tas6424.c+9−3

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

sound/soc/codecs/wm8804-i2c.c+14−1

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

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

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

sound/soc/intel/boards/bytcr_rt5640.c+26−0

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

sound/soc/intel/skylake/skl.c+1−1

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

sound/soc/qcom/qdsp6/q6routing.c+3−1

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

sound/soc/sh/rcar/adg.c+5−0

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

sound/soc/sh/rcar/core.c+20−1

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

sound/soc/sh/rcar/dma.c+4−0

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

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

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

sound/soc/sh/rcar/ssi.c+10−6

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

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

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

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

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

tools/arch/arm/include/uapi/asm/kvm.h+13−0

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

tools/arch/arm64/include/uapi/asm/kvm.h+13−0

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

tools/arch/s390/include/uapi/asm/kvm.h+4−1

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

tools/arch/x86/include/uapi/asm/kvm.h+37−0

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

tools/hv/hv_kvp_daemon.c+1−1

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

tools/include/linux/lockdep.h+3−0

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

tools/include/linux/nmi.h+0−0

Empty file added.

tools/include/tools/libc_compat.h+1−1

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

tools/include/uapi/asm-generic/unistd.h+3−1

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

tools/include/uapi/drm/drm.h+9−0

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

tools/include/uapi/linux/if_link.h+17−0

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

tools/include/uapi/linux/kvm.h+6−0

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

tools/include/uapi/linux/perf_event.h+1−1

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

tools/include/uapi/linux/vhost.h+18−0

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

tools/kvm/kvm_stat/kvm_stat+49−10

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

tools/lib/bpf/Build+1−1

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

tools/lib/bpf/libbpf.c+10−10

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

tools/lib/bpf/str_error.c+18−0

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

tools/lib/bpf/str_error.h+6−0

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

tools/perf/Documentation/Makefile+1−1

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

tools/perf/Makefile.perf+6−8

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

tools/perf/arch/arm64/Makefile+3−2

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

tools/perf/arch/arm64/entry/syscalls/mksyscalltbl+3−3

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

tools/perf/arch/powerpc/util/sym-handling.c+3−1

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

tools/perf/arch/x86/include/arch-tests.h+1−0

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

tools/perf/arch/x86/tests/Build+1−0

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

tools/perf/arch/x86/tests/arch-tests.c+6−0

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

tools/perf/arch/x86/tests/bp-modify.c+213−0

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

tools/perf/util/annotate.c+29−3

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

tools/perf/util/annotate.h+1−0

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

tools/perf/util/evsel.c+3−2

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

tools/perf/util/map.c+11−0

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

tools/perf/util/trace-event-info.c+1−1

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

tools/perf/util/trace-event-parse.c+3−4

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

tools/testing/selftests/android/Makefile+1−1

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

tools/testing/selftests/android/configrenamed from tools/testing/selftests/android/ion/config+0−0

File renamed without changes.

tools/testing/selftests/android/ion/Makefile+2−0

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

tools/testing/selftests/bpf/test_maps.c+7−3

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

tools/testing/selftests/cgroup/.gitignore+1−0

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

tools/testing/selftests/cgroup/cgroup_util.c+35−3

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

tools/testing/selftests/cgroup/cgroup_util.h+1−0

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

tools/testing/selftests/cgroup/test_memcontrol.c+205−0

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

tools/testing/selftests/efivarfs/config+1−0

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

tools/testing/selftests/futex/functional/Makefile+1−0

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

tools/testing/selftests/gpio/Makefile+2−5

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

tools/testing/selftests/kselftest.h+0−1

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

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

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

tools/testing/selftests/kvm/Makefile+5−7

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

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

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

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

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

tools/testing/selftests/kvm/platform_info_test.c+110−0

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

tools/testing/selftests/lib.mk+12−0

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

tools/testing/selftests/memory-hotplug/config+1−0

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

tools/testing/selftests/net/Makefile+1−0

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

tools/testing/selftests/net/pmtu.sh+2−2

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

tools/testing/selftests/net/tls.c+49−0

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

tools/testing/selftests/networking/timestamping/Makefile+1−0

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

tools/testing/selftests/powerpc/alignment/Makefile+1−0

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

tools/testing/selftests/powerpc/benchmarks/Makefile+1−0

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

tools/testing/selftests/powerpc/cache_shape/Makefile+1−0

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

tools/testing/selftests/powerpc/copyloops/Makefile+1−0

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

tools/testing/selftests/powerpc/dscr/Makefile+1−0

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

tools/testing/selftests/powerpc/math/Makefile+1−0

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

tools/testing/selftests/powerpc/mm/Makefile+1−0

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

tools/testing/selftests/powerpc/pmu/Makefile+1−0

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

tools/testing/selftests/powerpc/pmu/ebb/Makefile+1−0

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

tools/testing/selftests/powerpc/primitives/Makefile+1−0

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

tools/testing/selftests/powerpc/ptrace/Makefile+1−0

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

tools/testing/selftests/powerpc/signal/Makefile+1−0

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

tools/testing/selftests/powerpc/stringloops/Makefile+1−0

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

tools/testing/selftests/powerpc/switch_endian/Makefile+1−0

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

tools/testing/selftests/powerpc/syscalls/Makefile+1−0

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

tools/testing/selftests/powerpc/tm/Makefile+1−0

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

tools/testing/selftests/powerpc/vphn/Makefile+1−0

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

tools/testing/selftests/vm/Makefile+0−4

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

virt/kvm/arm/mmu.c+8−13

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

virt/kvm/arm/trace.h+0−15

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